Prod => Dev #3
@@ -154,7 +154,8 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
|
||||
logger.info("Sending OCR text to metadata API: %s", doc.ocr_text)
|
||||
|
||||
response = requests.post(
|
||||
"http://automation-service:8006/metadata",
|
||||
#"http://automation-service:8006/metadata",
|
||||
"http://automation-service:8006/parse",
|
||||
json={"text": doc.ocr_text or ""}
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
72
modules/automation/execution_automation.py
Normal file
72
modules/automation/execution_automation.py
Normal file
@@ -0,0 +1,72 @@
|
||||
from trytond.model import ModelSQL, fields
|
||||
|
||||
class ExecutionFollowUp(ModelSQL):
|
||||
"Execution Follow Up"
|
||||
__name__ = 'execution.automation'
|
||||
|
||||
port_of_loading = fields.Char("Port of Loading")
|
||||
fb_loading = fields.Char("FB Loading")
|
||||
warehouse = fields.Char("Warehouse")
|
||||
origin = fields.Char("Origin")
|
||||
agent = fields.Char("Agent")
|
||||
operator = fields.Char("Operator")
|
||||
|
||||
fintrade_lc_nb = fields.Char("Fintrade LC Nb")
|
||||
lc_number = fields.Char("LC Number")
|
||||
si = fields.Char("SI")
|
||||
|
||||
port_of_destination = fields.Char("Port of Destination")
|
||||
fb_destination = fields.Char("FB Destination")
|
||||
status = fields.Char("Status")
|
||||
|
||||
etd_date = fields.Date("ETD Date")
|
||||
bl_date = fields.Date("BL Date")
|
||||
etd_sob = fields.Date("ETD SOB")
|
||||
|
||||
sale_contract_no = fields.Char("Sale Contract No")
|
||||
customer = fields.Char("Customer")
|
||||
elt_quantity = fields.Float("Elt Quantity")
|
||||
|
||||
number_of_container = fields.Integer("Containers")
|
||||
vessel = fields.Char("Vessel")
|
||||
shipping_company = fields.Char("Shipping Company")
|
||||
booking_ref = fields.Char("Booking Ref")
|
||||
freight_forwarder = fields.Char("Freight Forwarder")
|
||||
|
||||
instrument_status = fields.Char("Instrument Status")
|
||||
ip_date = fields.Date("IP Date")
|
||||
ip_status = fields.Char("IP Status")
|
||||
latest_shipment_date = fields.Date("Latest Shipment Date")
|
||||
|
||||
countersigned = fields.Boolean("Countersigned")
|
||||
comments = fields.Text("Comments")
|
||||
docs_internal_comments = fields.Text("Docs Internal Comments")
|
||||
|
||||
alloc_quantity = fields.Float("Allocated Quantity")
|
||||
si_comments = fields.Text("SI Comments")
|
||||
is_archived = fields.Boolean("Archived")
|
||||
|
||||
price_cont = fields.Numeric("Price / Cont")
|
||||
price_cont_curr = fields.Char("Currency")
|
||||
|
||||
ct_period_start = fields.Date("CT Start")
|
||||
ct_period_end = fields.Date("CT End")
|
||||
|
||||
lsd_check = fields.Char("LSD Check")
|
||||
bl2lsd_delta = fields.Integer("BL → LSD Delta")
|
||||
|
||||
fintrade_booking = fields.Char("Fintrade Booking")
|
||||
alloc_unit_price = fields.Numeric("Alloc Unit Price")
|
||||
alloc_price_curr = fields.Char("Alloc Price Curr")
|
||||
alloc_price_unit = fields.Char("Alloc Price Unit")
|
||||
|
||||
left_time = fields.Integer("Days Left")
|
||||
|
||||
@classmethod
|
||||
def table_query(cls):
|
||||
return (
|
||||
"SELECT "
|
||||
"row_number() OVER () AS id, "
|
||||
"* "
|
||||
"FROM singa_execution_follow_up"
|
||||
)
|
||||
9
modules/automation/execution_automation.xml
Normal file
9
modules/automation/execution_automation.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="execution_followup_tree">
|
||||
<field name="model">execution.automation</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">execution_automation_tree</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
60
modules/automation/view/execution_automation_tree.xml
Normal file
60
modules/automation/view/execution_automation_tree.xml
Normal file
@@ -0,0 +1,60 @@
|
||||
<tree>
|
||||
<field name="port_of_loading"/>
|
||||
<field name="fb_loading"/>
|
||||
<field name="warehouse"/>
|
||||
<field name="origin"/>
|
||||
<field name="agent"/>
|
||||
<field name="operator"/>
|
||||
|
||||
<field name="fintrade_lc_nb"/>
|
||||
<field name="lc_number"/>
|
||||
<field name="si"/>
|
||||
|
||||
<field name="port_of_destination"/>
|
||||
<field name="fb_destination"/>
|
||||
<field name="status"/>
|
||||
|
||||
<field name="etd_date"/>
|
||||
<field name="bl_date"/>
|
||||
<field name="etd_sob"/>
|
||||
|
||||
<field name="sale_contract_no"/>
|
||||
<field name="customer"/>
|
||||
<field name="elt_quantity"/>
|
||||
|
||||
<field name="number_of_container"/>
|
||||
<field name="vessel"/>
|
||||
<field name="shipping_company"/>
|
||||
<field name="booking_ref"/>
|
||||
<field name="freight_forwarder"/>
|
||||
|
||||
<field name="instrument_status"/>
|
||||
<field name="ip_date"/>
|
||||
<field name="ip_status"/>
|
||||
<field name="latest_shipment_date"/>
|
||||
|
||||
<field name="countersigned"/>
|
||||
<field name="comments"/>
|
||||
<field name="docs_internal_comments"/>
|
||||
|
||||
<field name="alloc_quantity"/>
|
||||
<field name="si_comments"/>
|
||||
<field name="is_archived"/>
|
||||
|
||||
<field name="price_cont"/>
|
||||
<field name="price_cont_curr"/>
|
||||
|
||||
<field name="ct_period_start"/>
|
||||
<field name="ct_period_end"/>
|
||||
|
||||
<field name="lsd_check"/>
|
||||
<field name="bl2lsd_delta"/>
|
||||
|
||||
<field name="fintrade_booking"/>
|
||||
<field name="alloc_unit_price"/>
|
||||
<field name="alloc_price_curr"/>
|
||||
<field name="alloc_price_unit"/>
|
||||
|
||||
<field name="left_time"/>
|
||||
|
||||
</tree>
|
||||
@@ -47,6 +47,8 @@ class Company(ModelSQL, ModelView):
|
||||
help="Used to compute the today date.")
|
||||
employees = fields.One2Many('company.employee', 'company', 'Employees',
|
||||
help="Add employees to the company.")
|
||||
|
||||
logo = fields.Binary("Logo")
|
||||
|
||||
@property
|
||||
def header_used(self):
|
||||
|
||||
@@ -17,6 +17,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="header"/>
|
||||
<separator name="footer"/>
|
||||
<field name="footer"/>
|
||||
<separator name="logo"/>
|
||||
<field name="logo" widget="image" stretch="true"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
@@ -72,6 +72,7 @@ def register():
|
||||
dashboard.News,
|
||||
dashboard.Demos,
|
||||
party.Party,
|
||||
party.PartyExecution,
|
||||
payment_term.PaymentTerm,
|
||||
payment_term.PaymentTermLine,
|
||||
purchase.Purchase,
|
||||
|
||||
@@ -155,7 +155,7 @@ class Party(metaclass=PoolMeta):
|
||||
if overdue > 0:
|
||||
# scale by overdue relative to limit
|
||||
limit = self.credit_limit or 1
|
||||
score += int(min(40, (overdue / float(limit)) * 100))
|
||||
score += int(min(40, (float(overdue) / float(limit)) * 100))
|
||||
|
||||
# cap
|
||||
if score > 100:
|
||||
|
||||
@@ -551,12 +551,14 @@ class Dashboard(ModelSQL, ModelView):
|
||||
return pu
|
||||
|
||||
def gen_url(self,name=None):
|
||||
Configuration = Pool().get('gr.configuration')
|
||||
config = Configuration.search(['id','>',0])[0]
|
||||
payload = {
|
||||
"resource": {"dashboard": self.bi_id},
|
||||
"params": {},
|
||||
"exp": datetime.datetime.utcnow() + datetime.timedelta(minutes=30),
|
||||
}
|
||||
token = jwt.encode(payload, "798f256d3119a3292bf121196c2a38dddf2cad155c0b6b0b444efc34c6db197c", algorithm="HS256")
|
||||
token = jwt.encode(payload, config.payload, algorithm="HS256")
|
||||
logger.info("TOKEN:%s",token)
|
||||
return f"metabase:http://vps107.geneva.hosting:3000/embed/dashboard/{token}#bordered=true&titled=true"
|
||||
|
||||
|
||||
@@ -385,11 +385,11 @@ class ForexBI(ModelSingleton,ModelSQL, ModelView):
|
||||
config = Configuration.search(['id','>',0])[0]
|
||||
|
||||
payload = {
|
||||
"resource": {"dashboard": 3},
|
||||
"resource": {"dashboard": config.forex_id},
|
||||
"params": {},
|
||||
"exp": datetime.datetime.utcnow() + datetime.timedelta(minutes=30),
|
||||
}
|
||||
token = jwt.encode(payload, "798f256d3119a3292bf121196c2a38dddf2cad155c0b6b0b444efc34c6db197c", algorithm="HS256")
|
||||
token = jwt.encode(payload, config.payload, algorithm="HS256")
|
||||
logger.info("TOKEN:%s",token)
|
||||
if config.dark:
|
||||
url = f"metabase:{config.bi}/embed/dashboard/{token}#theme=night&bordered=true&titled=true"
|
||||
|
||||
@@ -13,4 +13,7 @@ class GRConfiguration(ModelSingleton, ModelSQL, ModelView):
|
||||
|
||||
bi = fields.Char("BI connexion")
|
||||
dashboard = fields.Char("Dashboard connexion")
|
||||
dark = fields.Boolean("Dark mode")
|
||||
dark = fields.Boolean("Dark mode")
|
||||
pnl_id = fields.Integer("Pnl ID")
|
||||
forex_id = fields.Integer("Forex ID")
|
||||
payload = fields.Char("Metabase payload")
|
||||
@@ -6,6 +6,14 @@ from trytond.modules.purchase_trade.purchase import (TRIGGERS)
|
||||
__all__ = ['Party']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
class PartyExecution(ModelSQL,ModelView):
|
||||
"Party Execution"
|
||||
__name__ = 'party.execution'
|
||||
|
||||
party = fields.Many2One('party.party',"Party")
|
||||
area = fields.Many2One('country.region',"Area")
|
||||
percent = fields.Numeric("% targeted")
|
||||
|
||||
class Party(metaclass=PoolMeta):
|
||||
__name__ = 'party.party'
|
||||
|
||||
@@ -13,5 +21,4 @@ class Party(metaclass=PoolMeta):
|
||||
tol_max = fields.Numeric("Tol + in %")
|
||||
wb = fields.Many2One('purchase.weight.basis',"Weight basis")
|
||||
association = fields.Many2One('purchase.association',"Association")
|
||||
|
||||
|
||||
execution = fields.One2Many('party.execution','party',"")
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
<record model="ir.ui.view" id="party_view_form">
|
||||
<field name="model">party.party</field>
|
||||
<field name="inherit" ref="party.party_view_form"/>
|
||||
<field name="name">party_form</field>
|
||||
</record>
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="party_view_form">
|
||||
<field name="model">party.party</field>
|
||||
<field name="inherit" ref="party.party_view_form"/>
|
||||
<field name="name">party_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="party_exec_view_form">
|
||||
<field name="model">party.execution</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">party_exec_tree</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
@@ -1011,11 +1011,11 @@ class PnlBI(ModelSingleton,ModelSQL, ModelView):
|
||||
config = Configuration.search(['id','>',0])[0]
|
||||
|
||||
payload = {
|
||||
"resource": {"dashboard": 2},
|
||||
"resource": {"dashboard": config.pnl_id},
|
||||
"params": {},
|
||||
"exp": datetime.datetime.utcnow() + datetime.timedelta(minutes=30),
|
||||
}
|
||||
token = jwt.encode(payload, "5d95b70853af02897d1240e2ee4834e2bf065a5132b5d09840fbef6cf683ae45", algorithm="HS256")
|
||||
token = jwt.encode(payload, config.payload, algorithm="HS256")
|
||||
logger.info("TOKEN:%s",token)
|
||||
if config.dark:
|
||||
url = f"metabase:{config.bi}/embed/dashboard/{token}#theme=night&bordered=true&titled=true"
|
||||
|
||||
@@ -5,4 +5,10 @@
|
||||
<field name="dashboard"/>
|
||||
<label name="dark"/>
|
||||
<field name="dark"/>
|
||||
<label name="pnl_id"/>
|
||||
<field name="pnl_id"/>
|
||||
<label name="forex_id"/>
|
||||
<field name="forex_id"/>
|
||||
<label name="payload"/>
|
||||
<field name="payload"/>
|
||||
</form>
|
||||
4
modules/purchase_trade/view/party_exec_tree.xml
Normal file
4
modules/purchase_trade/view/party_exec_tree.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<tree>
|
||||
<field name="area"/>
|
||||
<field name="percent"/>
|
||||
</tree>
|
||||
@@ -12,5 +12,8 @@
|
||||
<label name="association"/>
|
||||
<field name="association"/>
|
||||
</page>
|
||||
<page string="Execution" col="4" id="ex">
|
||||
<field name="execution"/>
|
||||
</page>
|
||||
</xpath>
|
||||
</data>
|
||||
Reference in New Issue
Block a user