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:
@@ -38,6 +38,7 @@ SKIP_NON_SUPPLIERS = False # Set to True to skip parties that aren't suppliers
|
||||
|
||||
|
||||
def import_purchase_contract_fees(csv_file):
|
||||
|
||||
"""Import purchase contract line fees from CSV"""
|
||||
|
||||
print(f"{'='*70}")
|
||||
@@ -184,7 +185,7 @@ def import_purchase_contract_fees(csv_file):
|
||||
|
||||
# Set type if found and field exists
|
||||
if mode and hasattr(fee, 'type'):
|
||||
fee.type = 'ordered' # Assuming all imported fees are 'ordered'
|
||||
fee.type = 'budgeted' # Assuming all imported fees are 'budgeted'
|
||||
|
||||
# Set weight_type if found and field exists
|
||||
if mode and hasattr(fee, 'weight_type'):
|
||||
@@ -212,6 +213,7 @@ def import_purchase_contract_fees(csv_file):
|
||||
fee.save()
|
||||
|
||||
print(f" ✓ Fee created successfully")
|
||||
print(f" Fee ID: {fee.id}")
|
||||
print(f" Product: {product.rec_name}")
|
||||
print(f" Supplier: {supplier.rec_name}")
|
||||
print(f" Price: {price} {currency.code}")
|
||||
|
||||
Reference in New Issue
Block a user