This commit is contained in:
2026-02-01 17:55:54 +01:00
parent 9a66952f50
commit 88eb890c46
5 changed files with 64 additions and 2 deletions

View File

@@ -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'])

View File

@@ -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")
payload = fields.Char("Metabase payload")
automation = fields.Boolean("Automation")

View File

@@ -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):

View File

@@ -11,4 +11,6 @@
<field name="forex_id"/>
<label name="payload"/>
<field name="payload"/>
<label name="automation"/>
<field name="automation"/>
</form>

View File

@@ -111,6 +111,21 @@ this repository contains the full copyright notices and license terms. -->
</xpath>
<xpath expr="//page[@id='other']" position="after">
<page string="Weight Report" col="4" id="wr">
<label name="controller"/>
<field name="controller"/>
<label name="send_instruction"/>
<field name="send_instruction"/>
<newline/>
<label name="instructions"/>
<field name="instructions"/>
<label name="add_bl"/>
<field name="add_bl"/>
<label name="add_invoice"/>
<field name="add_invoice"/>
<newline/>
<label name="returned_id"/>
<field name="returned_id"/>
<newline/>
<field name="shipment_wr" colspan="4" mode="tree" view_ids="purchase_trade.shipment_wr_view_tree"/>
</page>
</xpath>