From fc1a3b8f42810bec0f41caf4919e5fabaa7fd472 Mon Sep 17 00:00:00 2001 From: Johan De Taeye Date: Sun, 24 Dec 2023 15:02:31 +0100 Subject: [PATCH 1/4] adding unicode name --- freppledata/data/product.template.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freppledata/data/product.template.csv b/freppledata/data/product.template.csv index 4d8c532d..d1205ee9 100644 --- a/freppledata/data/product.template.csv +++ b/freppledata/data/product.template.csv @@ -4,4 +4,4 @@ __export__.product_template_44_67fbc973,1,chair leg,,1,0,__export__.product_prod __export__.product_template_46_a06bf0d6,1,cushion,,1,0,__export__.product_product_56_ea472d4f,Storable Product __export__.product_template_48_019c3042,1,varnish,,1,0,__export__.product_product_57_9ea5498d,Storable Product __export__.product_template_43_c7599540,1,varnished chair,,90,45,__export__.product_product_57_5aef267e,Storable Product -__export__.product_template_45_403ca5bc,1,wooden beam,,1,0,__export__.product_product_58_8eba4d11,Storable Product +__export__.product_template_45_403ca5bc,1,wooden beam - 木头,,1,0,__export__.product_product_58_8eba4d11,Storable Product \ No newline at end of file From adf3b58301fae1087470d6124dfe99966f5ec30b Mon Sep 17 00:00:00 2001 From: Hicham Lahlou Date: Wed, 10 Jan 2024 22:09:16 +0100 Subject: [PATCH 2/4] supplier has id at the end of its name --- frepple/controllers/inbound.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frepple/controllers/inbound.py b/frepple/controllers/inbound.py index fa8f0386..3630304a 100644 --- a/frepple/controllers/inbound.py +++ b/frepple/controllers/inbound.py @@ -182,7 +182,7 @@ def run(self): ordertype = elem.get("ordertype") if ordertype == "PO": # Create purchase order - supplier_id = int(elem.get("supplier").split(" ", 1)[0]) + supplier_id = int(elem.get("supplier").rsplit(" ", 1)[-1]) quantity = elem.get("quantity") date_planned = elem.get("end") if date_planned: @@ -198,9 +198,7 @@ def run(self): po = proc_order.create( { "company_id": self.company.id, - "partner_id": int( - elem.get("supplier").split(" ", 1)[0] - ), + "partner_id": supplier_id, # TODO Odoo has no place to store the location and criticality # int(elem.get('location_id')), # elem.get('criticality'), From 20036fa19adb3f9137d2038896c8361024a3f14f Mon Sep 17 00:00:00 2001 From: Hicham Lahlou Date: Wed, 10 Jan 2024 22:47:12 +0100 Subject: [PATCH 3/4] adding the payment term id to the PO --- frepple/controllers/inbound.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frepple/controllers/inbound.py b/frepple/controllers/inbound.py index 3630304a..fcc9e164 100644 --- a/frepple/controllers/inbound.py +++ b/frepple/controllers/inbound.py @@ -205,6 +205,9 @@ def run(self): "origin": "frePPLe", } ) + po.payment_term_id = ( + po.partner_id.property_supplier_payment_term_id.id + ) supplier_reference[supplier_id] = { "id": po.id, "min_planned": date_planned, From 335d3c85b24c50495815514f22f807f5af9b7260 Mon Sep 17 00:00:00 2001 From: Johan De Taeye Date: Fri, 12 Jan 2024 15:40:07 +0100 Subject: [PATCH 4/4] connector now sets the current date + black + use 2030/12/31 instead of 2030/01/01 --- frepple/controllers/outbound.py | 58 +++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/frepple/controllers/outbound.py b/frepple/controllers/outbound.py index 768dfd07..813bf572 100644 --- a/frepple/controllers/outbound.py +++ b/frepple/controllers/outbound.py @@ -222,6 +222,9 @@ def run(self): yield '\n' % self.mode yield "Generated by odoo %s\n" % odoo.release.version + self.currentdate = datetime.now() + yield "%s" % self.currentdate.strftime("%Y-%m-%dT%H:%M:%S") + # Synchronize users yield from self.export_users() @@ -458,7 +461,7 @@ def export_calendar(self): resource.calendar.name -> calendar.name (default value is 0) resource.calendar.attendance.date_from -> calendar bucket start date (or 2020-01-01 if unspecified) - resource.calendar.attendance.date_to -> calendar bucket end date (or 2030-01-01 if unspecified) + resource.calendar.attendance.date_to -> calendar bucket end date (or 2030-12-31 if unspecified) resource.calendar.attendance.hour_from -> calendar bucket start time resource.calendar.attendance.hour_to -> calendar bucket end time resource.calendar.attendance.dayofweek -> calendar bucket day @@ -641,12 +644,12 @@ def export_calendar(self): else ( j["date_to"].strftime("%Y-%m-%dT00:00:00") if j["date_to"] - else "2030-01-01T00:00:00" + else "2030-12-31T00:00:00" ), "1" if j["attendance"] else "0", (2 ** ((int(j["dayofweek"]) + 1) % 7)) if "dayofweek" in j - else (2 ** 7) - 1, + else (2**7) - 1, priority_attendance if j["attendance"] else priority_leave, # In odoo, monday = 0. In frePPLe, sunday = 0. ("PT%dM" % round(j["hour_from"] * 60)) @@ -663,7 +666,7 @@ def export_calendar(self): else: # TWO-WEEKS CALENDAR start = j["date_from"] or datetime(2020, 1, 1) - end = j["date_to"] or datetime(2030, 1, 1) + end = j["date_to"] or datetime(2030, 12, 31) t = start while t < end: @@ -679,7 +682,7 @@ def export_calendar(self): "1", (2 ** ((int(j["dayofweek"]) + 1) % 7)) if "dayofweek" in j - else (2 ** 7) - 1, + else (2**7) - 1, priority_attendance, # In odoo, monday = 0. In frePPLe, sunday = 0. ("PT%dM" % round(j["hour_from"] * 60)) @@ -1547,24 +1550,29 @@ def export_boms(self): not in self.map_workcenters ): continue - secondary_workcenter_str += '%s' % ( - 1 - if not secondary_workcenter["duration"] - or step["time_cycle"] == 0 - else secondary_workcenter["duration"] - / step["time_cycle"], - quoteattr(secondary_workcenter["search_mode"]), - quoteattr( - self.map_workcenters[ - secondary_workcenter["workcenter_id"][0] - ] - ), - ( - "" - % quoteattr(secondary_workcenter["skill"][1]) + secondary_workcenter_str += ( + '%s' + % ( + 1 + if not secondary_workcenter["duration"] + or step["time_cycle"] == 0 + else secondary_workcenter["duration"] + / step["time_cycle"], + quoteattr(secondary_workcenter["search_mode"]), + quoteattr( + self.map_workcenters[ + secondary_workcenter["workcenter_id"][0] + ] + ), + ( + "" + % quoteattr( + secondary_workcenter["skill"][1] + ) + ) + if secondary_workcenter["skill"] + else "", ) - if secondary_workcenter["skill"] - else "", ) yield "" '\n' "\n" '%s%s\n' % ( @@ -2498,21 +2506,23 @@ def export_orderpoints(self): if i["product_min_qty"]: yield """ - + \n """ % ( (quoteattr("SS for %s" % (name,))), + self.currentdate.strftime("%Y-%m-%dT%H:%M:%S"), (i["product_min_qty"] * uom_factor), ) if i["product_max_qty"] - i["product_min_qty"] > 0: yield """ - + \n """ % ( (quoteattr("ROQ for %s" % (name,))), + self.currentdate.strftime("%Y-%m-%dT%H:%M:%S"), ((i["product_max_qty"] - i["product_min_qty"]) * uom_factor), ) if not first: