Merge pull request #39237 from ruthra-kumar/github_issue_38868

fix: sales team commission overallocation on fetching items from multiple quotations to Sales Order
This commit is contained in:
ruthra kumar 2024-01-09 13:06:28 +05:30 committed by GitHub
commit 3b861798e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -370,15 +370,16 @@ def _make_sales_order(source_name, target_doc=None, customer_group=None, ignore_
)
# sales team
for d in customer.get("sales_team") or []:
target.append(
"sales_team",
{
"sales_person": d.sales_person,
"allocated_percentage": d.allocated_percentage or None,
"commission_rate": d.commission_rate,
},
)
if not target.get("sales_team"):
for d in customer.get("sales_team") or []:
target.append(
"sales_team",
{
"sales_person": d.sales_person,
"allocated_percentage": d.allocated_percentage or None,
"commission_rate": d.commission_rate,
},
)
target.flags.ignore_permissions = ignore_permissions
target.delivery_date = nowdate()