Add scripts for importing prices and sale contract fees; update purchase fees script
- Implemented `import_prices.py` to import price index values from a CSV file with migration mapping. - Created `import_sale_fees.py` for importing sale contract line fees, including detailed logging and error handling. - Modified `import_purchase_fees.py` to change fee type from 'ordered' to 'budgeted' and added fee ID logging.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -9,10 +9,12 @@ SUPPLIER_STOCK_LOCATIONS_CSV = 'loaders/supplier_stock_locations.csv'
|
||||
SERVICES_CSV = 'loaders/services.csv'
|
||||
VESSELS_CSV = 'loaders/vessels.csv'
|
||||
|
||||
PURCHASE_CONTRACTS_CSV = 'loaders/Purchase_Contracts_with_mapping.csv'
|
||||
PURCHASE_FEES_CSV = 'loaders/purchase_fees.csv'
|
||||
PURCHASE_CONTRACTS_CSV = 'C:/Users/SylvainDUVERNAY/Open Squared/Production - Documents/TRADON Implementation/ITSA/Reference Data/python_project/loaders/Purchase_Contracts_with_mapping.csv'
|
||||
PURCHASE_FEES_CSV = 'Reference Data\python_project\loaders\Purchase_Fees 2.csv'
|
||||
|
||||
SALE_CONTRACTS_CSV = 'loaders/Sale_Contracts_with_mapping.csv'
|
||||
SALE_CONTRACTS_CSV = 'Reference Data\python_project\loaders\Sale_Contracts_with_mapping.csv'
|
||||
SALE_FEES_CSV = 'loaders/sale_fees.csv'
|
||||
PRICES_CSV = 'loaders/Prices_6.csv'
|
||||
|
||||
|
||||
# XML-RPC Configuration (for Proteus interaction)
|
||||
|
||||
@@ -510,10 +510,17 @@ def find_sale_contract_by_number(contract_number):
|
||||
|
||||
Sale = Model.get('sale.sale')
|
||||
|
||||
# Search by number and party fields
|
||||
# Search by number
|
||||
contracts = Sale.find([
|
||||
('number', '=', contract_number.strip())
|
||||
])
|
||||
|
||||
# If not found, try by adding "S-" prefix (if not already present)
|
||||
if not contracts and not contract_number.strip().startswith('S-'):
|
||||
prefixed_number = f"S-{contract_number.strip()}"
|
||||
contracts = Sale.find([
|
||||
('number', '=', prefixed_number)
|
||||
])
|
||||
|
||||
if contracts:
|
||||
return contracts[0]
|
||||
|
||||
Reference in New Issue
Block a user