02.02.26
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -113,19 +113,18 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<page string="Weight Report" col="4" id="wr">
|
||||
<label name="controller"/>
|
||||
<field name="controller"/>
|
||||
<button name="send" string="Send"/>
|
||||
<button name="send" string="Send email to controller"/>
|
||||
<newline/>
|
||||
<label name="result"/>
|
||||
<field name="result"/>
|
||||
<newline/>
|
||||
<label name="instructions"/>
|
||||
<field name="instructions"/>
|
||||
<newline/>
|
||||
<label name="add_bl"/>
|
||||
<field name="add_bl"/>
|
||||
<label name="add_invoice"/>
|
||||
<field name="add_invoice"/>
|
||||
<newline/>
|
||||
<label name="instructions"/>
|
||||
<field name="instructions" widget="html_viewer" colspan="4" height="100"/>
|
||||
<label name="add_bl"/>
|
||||
<field name="add_bl"/>
|
||||
<newline/>
|
||||
<label name="returned_id"/>
|
||||
<field name="returned_id"/>
|
||||
<newline/>
|
||||
|
||||
Reference in New Issue
Block a user