diff --git a/modules/automation/cron.py b/modules/automation/cron.py index 04c64b4..0f321bc 100644 --- a/modules/automation/cron.py +++ b/modules/automation/cron.py @@ -310,6 +310,7 @@ class AutomationCron(ModelSQL, ModelView): ShipmentIn.save([shipment]) shipment._create_lots_from_fintrade() shipment.controller = shipment.get_controller() + shipment.instructions = shipment.get_instructions() ShipmentIn.save([shipment]) trans_shipment.commit() successful_shipments += 1 diff --git a/modules/purchase_trade/stock.py b/modules/purchase_trade/stock.py index c5d4f6b..b7bac3f 100755 --- a/modules/purchase_trade/stock.py +++ b/modules/purchase_trade/stock.py @@ -463,6 +463,26 @@ class ShipmentIn(metaclass=PoolMeta): if c.party.IsAvailableForControl(self): return c.party + def get_instructions(self): + lines = [ + "Hi,", + "", + "Please find details below for the requested control", + f"BL number: {self.bl_number}", + "" + ] + + if self.incoming_moves: + for m in self.incoming_moves: + if m.lot: + lines.append( + f"Lot nb: {m.lot.lot_number} | " + f"Net Qt: {m.lot.get_current_quantity()} {m.lot.lot_unit.symbol} | " + f"Gross Qt: {m.lot.get_current_gross_quantity()} {m.lot.lot_unit.symbol}" + ) + + return "\n".join(lines) + def _create_lots_from_fintrade(self): t = Table('freight_booking_lots') cursor = Transaction().connection.cursor() @@ -671,7 +691,8 @@ class ShipmentIn(metaclass=PoolMeta): response.raise_for_status() data = response.json() logger.info("SEND_FROM_SHIPMENT:%s",data) - sh.result = "Email sent on " + Date.today() + now = datetime.datetime.now() + sh.result = f"Email sent on {now.strftime('%d/%m/%Y %H:%M')}" sh.save() @classmethod diff --git a/modules/purchase_trade/view/shipment_in_form.xml b/modules/purchase_trade/view/shipment_in_form.xml index c210ba8..4791ecf 100755 --- a/modules/purchase_trade/view/shipment_in_form.xml +++ b/modules/purchase_trade/view/shipment_in_form.xml @@ -113,19 +113,18 @@ this repository contains the full copyright notices and license terms. -->