This commit is contained in:
2026-01-20 20:19:56 +01:00
parent 8a54b6fcbc
commit fcb6377b21

View File

@@ -106,17 +106,17 @@ class WeightReport(ModelSQL, ModelView):
# Recherche ou création des parties
seller_name = parties_data.get('seller', '')
if seller_name:
seller = Party.find_or_create_by_name(seller_name)
seller = Party.getPartyByName(seller_name)
report['seller'] = seller.id if seller else None
buyer_name = parties_data.get('buyer', '')
if buyer_name:
buyer = Party.find_or_create_by_name(buyer_name)
buyer = Party.getPartyByName(buyer_name)
report['buyer'] = buyer.id if buyer else None
carrier_name = parties_data.get('carrier', '')
if carrier_name:
carrier = Party.find_or_create_by_name(carrier_name)
carrier = Party.getPartyByName(carrier_name)
report['carrier'] = carrier.id if carrier else None
# 5. Shipment Information
@@ -143,7 +143,7 @@ class WeightReport(ModelSQL, ModelView):
if port_loading_name:
port_loading = Location.search([
('name', '=', port_loading_name),
('type', '=', 'storage')
('type', '=', 'supplier')
], limit=1)
report['port_loading'] = port_loading[0].id if port_loading else None
@@ -151,7 +151,7 @@ class WeightReport(ModelSQL, ModelView):
if port_destination_name:
port_destination = Location.search([
('name', '=', port_destination_name),
('type', '=', 'storage')
('type', '=', 'customer')
], limit=1)
report['port_destination'] = port_destination[0].id if port_destination else None