diff --git a/frepple/controllers/inbound.py b/frepple/controllers/inbound.py index dc790046..a65d485e 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,15 +198,16 @@ 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'), "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, diff --git a/frepple/controllers/outbound.py b/frepple/controllers/outbound.py index c119751c..ba466fe2 100644 --- a/frepple/controllers/outbound.py +++ b/frepple/controllers/outbound.py @@ -221,6 +221,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() @@ -457,7 +460,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 @@ -640,7 +643,7 @@ 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)) @@ -662,7 +665,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: @@ -2509,21 +2512,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: 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