Skip to content

Commit

Permalink
Merge pull request #427 from frePPLe/15.0
Browse files Browse the repository at this point in the history
Syncing from upstream frePPLe/odoo (15.0)
  • Loading branch information
bt-admin authored Mar 6, 2024
2 parents d844e56 + 81f6b4f commit 17b2df1
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions frepple/controllers/outbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@ def __init__(
self.timeformat = "%Y-%m-%dT%H:%M:%S"
self.singlecompany = singlecompany
self.delta = delta
self.has_subcontracting = (
len(
self.generator.getData(
"ir.module.module",
search=[
("state", "=", "installed"),
("name", "=", "mrp_subcontracting"),
],
fields=["id"],
)
)
> 0
)

# The mode argument defines different types of runs:
# - Mode 1:
Expand Down Expand Up @@ -2102,26 +2115,29 @@ def export_purchaseorders(self):

# Create purchasing operations from stock moves
if stock_move_ids:
fields = [
"state",
"product_id",
"product_qty",
"quantity_done",
"reference",
"product_uom",
"location_dest_id",
"origin",
"picking_id",
"date",
"purchase_line_id",
"move_orig_ids",
]

if self.has_subcontracting:
fields.append("is_subcontract")
yield "<!-- open purchase orders from PO receipts-->\n"
yield "<operationplans>\n"
for i in self.generator.getData(
"stock.move",
ids=stock_move_ids,
fields=[
"state",
"product_id",
"product_qty",
"quantity_done",
"reference",
"product_uom",
"location_dest_id",
"origin",
"picking_id",
"date",
"purchase_line_id",
"is_subcontract",
"move_orig_ids",
],
fields=fields,
):
if (
not i["product_id"]
Expand All @@ -2137,7 +2153,7 @@ def export_purchaseorders(self):
i["id"],
i["purchase_line_id"][0],
)
if i["is_subcontract"]:
if self.has_subcontracting and i["is_subcontract"]:
# PO lines on a subcontracting BOM are mapped as a MO in frepple
for k in self.generator.getData(
"stock.move",
Expand Down

0 comments on commit 17b2df1

Please sign in to comment.