Faircot cron

This commit is contained in:
2026-07-19 21:59:22 +02:00
parent a94f36e26f
commit bd72f8cef3
3 changed files with 204 additions and 99 deletions

View File

@@ -348,15 +348,23 @@ class AutomationCron(ModelSQL, ModelView):
with Transaction().set_context(
_purchase_trade_skip_physical_lot_tolerance_warning=True):
inv_date, inv_nb = shipment._create_lots_from_fintrade()
shipment.controller = shipment.get_controller()
shipment.controller_target = controller
shipment.create_fee(shipment.controller)
shipment.instructions = shipment.get_instructions_html(
inv_date, inv_nb)
ShipmentIn.save([shipment])
shipment = ShipmentIn(shipment.id)
if shipment.incoming_moves:
shipment.controller = shipment.get_controller()
shipment.controller_target = controller
shipment.create_fee(shipment.controller)
shipment.instructions = shipment.get_instructions_html(
inv_date, inv_nb)
ShipmentIn.save([shipment])
else:
logger.info(
"Shipment %s cree sans lots : fees/instructions "
"non crees, voir FINTRADE_CLEANUP_NEEDED",
si_number)
trans_shipment.commit()
successful_shipments += 1
logger.info(f"Shipment {si_number} cree avec succes")
if shipment.incoming_moves:
successful_shipments += 1
logger.info(f"Shipment {si_number} cree avec succes")
except Exception as e:
error_details = {