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
The current version is 1.2.3. Please check changelog.md for more information.
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.
- Clone this repo
- Ensure that you have Pipenv installed
- Install the openpyxl dependency -
pipenv install
- 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
- Enter the virtual environment -
pipenv shell
- 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