Skip to content

Commit

Permalink
Merge branch '14.0-fix-stock_orderpoint_origin-source_groups' of git+…
Browse files Browse the repository at this point in the history
…ssh://github.com/efatto/stock-logistics-warehouse into 14.0
  • Loading branch information
Pretecno committed Dec 25, 2024
2 parents ec97ca1 + 11bdfa7 commit 5cc25be
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions stock_orderpoint_origin/models/procurement_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,23 @@ def run(self, procurements, raise_user_error=True):
# stock.picking object doesn't have field procurement_group_id,
# so we check if the source document is a picking to use the
# correct field (group_id)
source_groups = [
x.procurement_group_id if x._name != "stock.picking" else x.group_id
for x in source_docs
]
source_groups = []
for source_doc in source_docs:
if (
source_doc.procurement_group_id
if source_doc._name != "stock.picking"
else source_doc.group_id
):
source_groups.append(
source_doc.procurement_group_id
if source_doc._name != "stock.picking"
else source_doc.group_id
)
source_names = ", ".join([x.name for x in source_docs])
new_origin = "%s (from %s)" % (source_names, procurement.origin)
new_procurement = procurement._replace(origin=new_origin)
new_procurement.values["source_group_ids"] = source_groups
if source_groups:
new_procurement.values["source_group_ids"] = source_groups
new_procurements.append(new_procurement)
else:
new_procurements.append(procurement)
Expand Down

0 comments on commit 5cc25be

Please sign in to comment.