Skip to content

Commit

Permalink
Merge pull request #398 from frePPLe/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream frePPLe/odoo (16.0)
  • Loading branch information
bt-admin authored Jan 22, 2024
2 parents 4b00dab + da0638a commit d271a0b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
9 changes: 5 additions & 4 deletions frepple/controllers/inbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down
15 changes: 10 additions & 5 deletions frepple/controllers/outbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ def run(self):
yield '<plan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" source="odoo_%s">\n' % self.mode
yield "<description>Generated by odoo %s</description>\n" % odoo.release.version

self.currentdate = datetime.now()
yield "<current>%s</current>" % self.currentdate.strftime("%Y-%m-%dT%H:%M:%S")

# Synchronize users
yield from self.export_users()

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand All @@ -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:
Expand Down Expand Up @@ -2509,21 +2512,23 @@ def export_orderpoints(self):
if i["product_min_qty"]:
yield """
<calendar name=%s default="0"><buckets>
<bucket start="2000-01-01T00:00:00" end="2030-12-31T00:00:00" value="%s" days="127" priority="998" starttime="PT0M" endtime="PT1440M"/>
<bucket start="%s" end="2030-12-31T00:00:00" value="%s" days="127" priority="998" starttime="PT0M" endtime="PT1440M"/>
</buckets>
</calendar>\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 """
<calendar name=%s default="0"><buckets>
<bucket start="2000-01-01T00:00:00" end="2030-12-31T00:00:00" value="%s" days="127" priority="998" starttime="PT0M" endtime="PT1440M"/>
<bucket start="%s" end="2030-12-31T00:00:00" value="%s" days="127" priority="998" starttime="PT0M" endtime="PT1440M"/>
</buckets>
</calendar>\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:
Expand Down
2 changes: 1 addition & 1 deletion freppledata/data/product.template.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d271a0b

Please sign in to comment.