From 68e0000afc82c9c7a5ca0500fe633e83fe44ad4f Mon Sep 17 00:00:00 2001
From: laurentbarontini
Date: Mon, 2 Feb 2026 17:44:47 +0100
Subject: [PATCH] 02.02.26
---
modules/automation/cron.py | 2 +-
modules/purchase_trade/stock.py | 72 ++++++++++++++++-----------------
2 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/modules/automation/cron.py b/modules/automation/cron.py
index 1c5c491..0f321bc 100644
--- a/modules/automation/cron.py
+++ b/modules/automation/cron.py
@@ -310,7 +310,7 @@ class AutomationCron(ModelSQL, ModelView):
ShipmentIn.save([shipment])
shipment._create_lots_from_fintrade()
shipment.controller = shipment.get_controller()
- shipment.instructions = shipment.get_instructions_html()
+ 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 6d70b8d..22f2b0f 100755
--- a/modules/purchase_trade/stock.py
+++ b/modules/purchase_trade/stock.py
@@ -466,45 +466,45 @@ class ShipmentIn(metaclass=PoolMeta):
if c.party.IsAvailableForControl(self):
return c.party
- def get_instructions_html(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_name} | "
- f"Net Qt: {m.lot.get_current_quantity()} {m.lot.lot_unit_line.symbol} | "
- f"Gross Qt: {m.lot.get_current_gross_quantity()} {m.lot.lot_unit_line.symbol}"
- "
"
- )
-
- return "".join(lines)
-
- # def get_instructions(self):
+ # def get_instructions_html(self):
# lines = [
- # "Hi,",
- # "",
- # "Please find details below for the requested control",
- # f"BL number: {self.bl_number}",
- # ""
+ # "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_name} | "
- # 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}"
+ # ""
+ # f"Lot nb: {m.lot.lot_name} | "
+ # f"Net Qt: {m.lot.get_current_quantity()} {m.lot.lot_unit_line.symbol} | "
+ # f"Gross Qt: {m.lot.get_current_gross_quantity()} {m.lot.lot_unit_line.symbol}"
+ # "
"
# )
- # return "\n".join(lines)
+ # return "".join(lines)
+
+ 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_name} | "
+ 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')
@@ -676,11 +676,11 @@ class ShipmentIn(metaclass=PoolMeta):
return sale_line
- def html_to_text(self,html_content):
- text = re.sub(r"
", "\n", html_content, flags=re.IGNORECASE)
- text = re.sub(r"
", "\n\n", text, flags=re.IGNORECASE)
- text = re.sub(r"<[^>]+>", "", text)
- return html.unescape(text).strip()
+ # def html_to_text(self,html_content):
+ # text = re.sub(r"
", "\n", html_content, flags=re.IGNORECASE)
+ # text = re.sub(r"", "\n\n", text, flags=re.IGNORECASE)
+ # text = re.sub(r"<[^>]+>", "", text)
+ # return html.unescape(text).strip()
@classmethod
@ModelView.button
@@ -697,7 +697,7 @@ class ShipmentIn(metaclass=PoolMeta):
payload = {
"to": [contact[0].value],
"subject": "Request for control",
- "body": sh.html_to_text(sh.instructions),
+ "body": sh.instructions,
# "attachments": [
# {
# "filename": "instruction.pdf",