This commit is contained in:
2026-01-26 12:42:49 +01:00
parent ef27c020e0
commit 4c70f0bc5f
4 changed files with 372 additions and 120 deletions

View File

@@ -2,6 +2,8 @@ from trytond.model import ModelSQL, ModelView, fields, Workflow
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval
from trytond.wizard import Button
from trytond.transaction import Transaction
from sql import Table
import requests
import io
import logging
@@ -203,6 +205,35 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
ShipmentWR.save([swr])
doc.notes = (doc.notes or "") + f"Shipment found: {sh[0].number}\n"
t = Table('freight_booking_lots')
cursor = Transaction().connection.cursor()
cursor.execute(*t.select(
t.BOOKING_NUMBER,
t.LOT_NUMBER,
t.LOT_NBR_BALES,
t.LOT_GROSS_WEIGHT,
t.LOT_NET_WEIGHT,
t.LOT_UOM,
t.LOT_QUALITY,
t.CUSTOMER,
t.SELL_PRICE_CURRENCY,
t.SELL_PRICE_UNIT,
t.SALE_INVOICE,
t.SELL_INV_AMOUNT,
t.SALE_INVOICE_DATE,
t.SELL_PREMIUM,
t.SALE_CONTRACT,
where=(t.BOOKING_NUMBER == sh[0].bl_number)
))
rows = cursor.fetchall()
if rows:
#Purchase & Sale creation
Purchase = Pool().get('purchase.purchase')
PurchaseLine = Pool().get('purchase.line')
for row in rows:
#Lots creation
pass
# if cls.rule_set.ocr_required:[]
# cls.run_ocr([doc])
# if cls.rule_set.structure_required and doc.state != "error":