dtodd-wipeos / xlsx-to-itad-odoo

Provides a mechanism to parse an XLSX spreadsheet and import the data into an Odoo instance with a proprietary ITAD module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XLSX to Odoo import

The goal of this program is to parse a spreadsheet (in a particular format from one of OceanTech's customers) and then load that parsed data into and Odoo instance that has the ITAD module.

This uses a "library" of sorts that I created for various projects that involves communicating with an Odoo instance. The library is found in api.py and exceptions.py, and supports full CRUD actions.

The types of records that are created are:

  • Sellable Records - These are records that form the basis of our "inventory". They contain basic information such as make and model, as well as reimbursement values
  • Asset Catalog Lines - These records are what appear in the asset catalog table. Each one is a line item
  • Data Destruction Lines - These records are what appear in the data destruction table. Each one is a line item

Version

The current version is 1.2.3. Please check changelog.md for more information.

Usage

This was designed to parse a very specific spreadsheet, and may work on others that are similar in layout. The ideas within this application should be able to be adapted towards processing other spreadsheets.

  1. Clone this repo
  2. Ensure that you have Pipenv installed
  3. Install the openpyxl dependency - pipenv install
  4. Edit run.sh to contain the configuration you need.
    • Point to your Odoo instance, with credentials that can search and create ITAD records
    • Spreadsheet configuration includes: Filename (relative or absolute), the Sheet to work from, as well as the rows and columns to fetch
    • Odoo configuration includes: Asset Catalog ID and Data Destruction ID. These are both the database ids of their respective forms. Used to connect the line items to specific records
    • SERIALS_TO_IGNORE specifies a list of serial numbers to not check for duplicates and to always create new records
  5. Enter the virtual environment - pipenv shell
  6. Start the application - ./run.sh - This can take a couple minutes depending on how big the spreadsheet is.
    • Normal output will be printed to the console
    • A log file will be generated in logs/<the epoch timestamp when started>.log with normal output
    • A csv file will be generated in ./<the epoch timestamp when started>.csv that contains line items that were ignored

About

Provides a mechanism to parse an XLSX spreadsheet and import the data into an Odoo instance with a proprietary ITAD module

License:MIT License


Languages

Language:HTML 78.6%Language:Python 17.9%Language:Shell 1.7%Language:Mako 1.7%Language:Dockerfile 0.1%