diff --git a/modules/automation/automation.py b/modules/automation/automation.py
index f17c2ba..38250d1 100644
--- a/modules/automation/automation.py
+++ b/modules/automation/automation.py
@@ -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()
diff --git a/modules/automation/execution_automation.py b/modules/automation/execution_automation.py
new file mode 100644
index 0000000..2e288cd
--- /dev/null
+++ b/modules/automation/execution_automation.py
@@ -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"
+ )
diff --git a/modules/automation/execution_automation.xml b/modules/automation/execution_automation.xml
new file mode 100644
index 0000000..cf9b3c7
--- /dev/null
+++ b/modules/automation/execution_automation.xml
@@ -0,0 +1,9 @@
+
+
+
+ execution.automation
+ tree
+ execution_automation_tree
+
+
+
\ No newline at end of file
diff --git a/modules/automation/view/execution_automation_tree.xml b/modules/automation/view/execution_automation_tree.xml
new file mode 100644
index 0000000..9c5b48a
--- /dev/null
+++ b/modules/automation/view/execution_automation_tree.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/company/company.py b/modules/company/company.py
index f8bd3c5..522c05a 100755
--- a/modules/company/company.py
+++ b/modules/company/company.py
@@ -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):
diff --git a/modules/company/view/company_form.xml b/modules/company/view/company_form.xml
index 07c9c1e..c957297 100755
--- a/modules/company/view/company_form.xml
+++ b/modules/company/view/company_form.xml
@@ -17,6 +17,8 @@ this repository contains the full copyright notices and license terms. -->
+
+
diff --git a/modules/purchase_trade/__init__.py b/modules/purchase_trade/__init__.py
index 3e449b1..3a496c5 100755
--- a/modules/purchase_trade/__init__.py
+++ b/modules/purchase_trade/__init__.py
@@ -72,6 +72,7 @@ def register():
dashboard.News,
dashboard.Demos,
party.Party,
+ party.PartyExecution,
payment_term.PaymentTerm,
payment_term.PaymentTermLine,
purchase.Purchase,
diff --git a/modules/purchase_trade/credit_risk.py b/modules/purchase_trade/credit_risk.py
index 1f0d779..90bf2d0 100644
--- a/modules/purchase_trade/credit_risk.py
+++ b/modules/purchase_trade/credit_risk.py
@@ -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:
diff --git a/modules/purchase_trade/dashboard.py b/modules/purchase_trade/dashboard.py
index 6b5cb63..d01aec7 100755
--- a/modules/purchase_trade/dashboard.py
+++ b/modules/purchase_trade/dashboard.py
@@ -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"
diff --git a/modules/purchase_trade/forex.py b/modules/purchase_trade/forex.py
index 9c83e95..3945d71 100755
--- a/modules/purchase_trade/forex.py
+++ b/modules/purchase_trade/forex.py
@@ -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"
diff --git a/modules/purchase_trade/global_reporting.py b/modules/purchase_trade/global_reporting.py
index 45aa6eb..fa5c188 100644
--- a/modules/purchase_trade/global_reporting.py
+++ b/modules/purchase_trade/global_reporting.py
@@ -13,4 +13,7 @@ class GRConfiguration(ModelSingleton, ModelSQL, ModelView):
bi = fields.Char("BI connexion")
dashboard = fields.Char("Dashboard connexion")
- dark = fields.Boolean("Dark mode")
\ No newline at end of file
+ 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
diff --git a/modules/purchase_trade/party.py b/modules/purchase_trade/party.py
index f0bb6c9..dcebfda 100755
--- a/modules/purchase_trade/party.py
+++ b/modules/purchase_trade/party.py
@@ -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',"")
diff --git a/modules/purchase_trade/party.xml b/modules/purchase_trade/party.xml
index f6200d3..d576412 100755
--- a/modules/purchase_trade/party.xml
+++ b/modules/purchase_trade/party.xml
@@ -1,5 +1,14 @@
-
- party.party
-
- party_form
-
\ No newline at end of file
+
+
+
+ party.party
+
+ party_form
+
+
+ party.execution
+ tree
+ party_exec_tree
+
+
+
\ No newline at end of file
diff --git a/modules/purchase_trade/purchase.py b/modules/purchase_trade/purchase.py
index 643e31d..c3d046a 100755
--- a/modules/purchase_trade/purchase.py
+++ b/modules/purchase_trade/purchase.py
@@ -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"
diff --git a/modules/purchase_trade/view/gr_configuration_form.xml b/modules/purchase_trade/view/gr_configuration_form.xml
index 672251f..4d154c7 100644
--- a/modules/purchase_trade/view/gr_configuration_form.xml
+++ b/modules/purchase_trade/view/gr_configuration_form.xml
@@ -5,4 +5,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/purchase_trade/view/party_exec_tree.xml b/modules/purchase_trade/view/party_exec_tree.xml
new file mode 100644
index 0000000..96981a3
--- /dev/null
+++ b/modules/purchase_trade/view/party_exec_tree.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/purchase_trade/view/party_form.xml b/modules/purchase_trade/view/party_form.xml
index 29091d9..4a052a6 100755
--- a/modules/purchase_trade/view/party_form.xml
+++ b/modules/purchase_trade/view/party_form.xml
@@ -12,5 +12,8 @@
+
+
+
\ No newline at end of file