From 88eb890c46b08a543382508c3267b930047930e0 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 1 Feb 2026 17:55:54 +0100 Subject: [PATCH] 01.02.26 --- modules/purchase_trade/dashboard.py | 40 ++++++++++++++++++- modules/purchase_trade/global_reporting.py | 3 +- modules/purchase_trade/stock.py | 6 +++ .../view/gr_configuration_form.xml | 2 + .../purchase_trade/view/shipment_in_form.xml | 15 +++++++ 5 files changed, 64 insertions(+), 2 deletions(-) diff --git a/modules/purchase_trade/dashboard.py b/modules/purchase_trade/dashboard.py index 1a8b9e2..c754531 100755 --- a/modules/purchase_trade/dashboard.py +++ b/modules/purchase_trade/dashboard.py @@ -235,8 +235,46 @@ class Dashboard(ModelSQL, ModelView): return round(1/f1,6), round(1/f2,6) if f2 else None, round(1/f3,6) if f3 else None, round(1/f4,6) if f4 else None, round(1/f5,6) if f5 else None, d1, d2, d3, d4, d5 def get_tremor(self,name): + Date = Pool().get('ir.date') Configuration = Pool().get('gr.configuration') config = Configuration.search(['id','>',0])[0] + Shipment = Pool().get('stock.shipment.in') + Fee = Pool().get('fee.fee') + WR = Pool().get('weight.report') + if config.automation: + shipment = Shipment.search([('state','!=','received')]) + shipment_trend = [sh for sh in shipment if sh.create_date == Date.today()] + controller = Shipment.search([('controller','!=',None)]) + controller_trend = [co for co in controller if co.create_date == Date.today()] + instruction = Shipment.search([('send_instruction','=',True)]) + instruction_trend = [si for si in instruction if si.create_date == Date.today()] + wr = WR.search([('id','>',0)]) + wr_trend = [w for w in wr if w.create_date == Date.today()] + so = Fee.search(['id','=',25]) + so_trend = [s for s in so if s.create_date == Date.today()] + return ( + config.dashboard + + "/dashboard/index.html?shipment=" + + str(len(shipment)) + + "&shipment_trend=" + + str(len(shipment_trend)) + + "&controller=" + + str(len(controller)) + + "&controller_trend=" + + str(len(controller_trend)) + + "&instruction=" + + str(len(instruction)) + + "&instruction_trend=" + + str(len(instruction_trend)) + + "&wr=" + + str(len(wr)) + + "&wr_trend=" + + str(len(wr_trend)) + + "&so=" + + str(len(so)) + + "&so_trend=" + + str(len(so_trend))) + f1,f2,f3,f4,f5,d1,d2,d3,d4,d5 = self.get_last_five_fx_rates() Valuation = Pool().get('valuation.valuation') total_t, total_t1, variation = Valuation.get_totals() @@ -271,7 +309,7 @@ class Dashboard(ModelSQL, ModelView): val_s = len(val) conf = Sale.search(['state','=','confirmed']) conf_s = len(conf) - Shipment = Pool().get('stock.shipment.in') + draft = Shipment.search(['state','=','draft']) shipment_d = len(draft) val = Shipment.search(['state','=','started']) diff --git a/modules/purchase_trade/global_reporting.py b/modules/purchase_trade/global_reporting.py index fa5c188..ba3a291 100644 --- a/modules/purchase_trade/global_reporting.py +++ b/modules/purchase_trade/global_reporting.py @@ -16,4 +16,5 @@ class GRConfiguration(ModelSingleton, ModelSQL, ModelView): dark = fields.Boolean("Dark mode") pnl_id = fields.Integer("Pnl ID") forex_id = fields.Integer("Forex ID") - payload = fields.Char("Metabase payload") \ No newline at end of file + payload = fields.Char("Metabase payload") + automation = fields.Boolean("Automation") \ No newline at end of file diff --git a/modules/purchase_trade/stock.py b/modules/purchase_trade/stock.py index d0dd7be..68d1d59 100755 --- a/modules/purchase_trade/stock.py +++ b/modules/purchase_trade/stock.py @@ -420,6 +420,12 @@ class ShipmentIn(metaclass=PoolMeta): 'Container' ) shipment_wr = fields.One2Many('shipment.wr','shipment_in',"WR") + controller = fields.Many2One('party.party',"Controller") + send_instruction = fields.Boolean("Send instruction") + instructions = fields.Text("Instructions") + add_bl = fields.Boolean("Add BL") + add_invoice = fields.Boolean("Add invoice") + returned_id = fields.Char("Returned ID") @classmethod def __setup__(cls): diff --git a/modules/purchase_trade/view/gr_configuration_form.xml b/modules/purchase_trade/view/gr_configuration_form.xml index 4d154c7..99bfd47 100644 --- a/modules/purchase_trade/view/gr_configuration_form.xml +++ b/modules/purchase_trade/view/gr_configuration_form.xml @@ -11,4 +11,6 @@