mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
Merge pull request #48667 from diptanilsaha/fix_pos_sales_partner
fix: sales partner on pos invoice
This commit is contained in:
@@ -1416,6 +1416,8 @@
|
|||||||
"width": "50%"
|
"width": "50%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"fetch_from": "sales_partner.commission_rate",
|
||||||
|
"fetch_if_empty": 1,
|
||||||
"fieldname": "commission_rate",
|
"fieldname": "commission_rate",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"label": "Commission Rate (%)",
|
"label": "Commission Rate (%)",
|
||||||
@@ -1573,7 +1575,7 @@
|
|||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-06-24 12:13:28.242649",
|
"modified": "2025-07-17 16:51:40.886083",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "POS Invoice",
|
"name": "POS Invoice",
|
||||||
|
|||||||
@@ -338,6 +338,11 @@ class POSInvoiceMergeLog(Document):
|
|||||||
invoice.flags.ignore_pos_profile = True
|
invoice.flags.ignore_pos_profile = True
|
||||||
invoice.pos_profile = ""
|
invoice.pos_profile = ""
|
||||||
|
|
||||||
|
# Unset Commission Section
|
||||||
|
invoice.set("sales_partner", None)
|
||||||
|
invoice.set("commission_rate", 0)
|
||||||
|
invoice.set("total_commission", 0)
|
||||||
|
|
||||||
return invoice
|
return invoice
|
||||||
|
|
||||||
def get_new_sales_invoice(self):
|
def get_new_sales_invoice(self):
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
{
|
{
|
||||||
"add_total_row": 0,
|
"add_total_row": 0,
|
||||||
|
"add_translate_data": 0,
|
||||||
"columns": [],
|
"columns": [],
|
||||||
"creation": "2013-05-06 12:28:23",
|
"creation": "2013-05-06 12:28:23",
|
||||||
"disable_prepared_report": 0,
|
|
||||||
"disabled": 0,
|
"disabled": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"filters": [],
|
"filters": [],
|
||||||
"idx": 3,
|
"idx": 6,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2021-10-06 06:26:07.881340",
|
"letterhead": null,
|
||||||
|
"modified": "2025-07-17 16:47:20.596297",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Partners Commission",
|
"name": "Sales Partners Commission",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"prepared_report": 0,
|
"prepared_report": 0,
|
||||||
"query": "SELECT\n sales_partner as \"Sales Partner:Link/Sales Partner:220\",\n\tsum(base_net_total) as \"Invoiced Amount (Excl. Tax):Currency:220\",\n\tsum(amount_eligible_for_commission) as \"Amount Eligible for Commission:Currency:220\",\n\tsum(total_commission) as \"Total Commission:Currency:170\",\n\tsum(total_commission)*100/sum(amount_eligible_for_commission) as \"Average Commission Rate:Percent:220\"\nFROM\n\t`tabSales Invoice`\nWHERE\n\tdocstatus = 1 and ifnull(base_net_total, 0) > 0 and ifnull(total_commission, 0) > 0\nGROUP BY\n\tsales_partner\nORDER BY\n\t\"Total Commission:Currency:120\"",
|
"query": "SELECT\n sales_partner as \"Sales Partner:Link / Sales Partner:220\",\n sum(base_net_total) as \"Invoiced Amount (Excl. Tax):Currency:220\",\n sum(amount_eligible_for_commission) as \"Amount Eligible for Commission:Currency:220\",\n sum(total_commission) as \"Total Commission:Currency:170\",\n sum(total_commission)*100 / sum(amount_eligible_for_commission) as \"Average Commission Rate:Percent:220\"\nFROM\n (\n SELECT\n sales_partner,\n base_net_total,\n total_commission,\n amount_eligible_for_commission\n FROM\n `tabSales Invoice` \n WHERE\n docstatus = 1\n AND NOT (is_consolidated = 1 AND is_created_using_pos = 0)\n AND IFNULL(base_net_total, 0) > 0\n AND IFNULL(total_commission, 0) > 0\n\n UNION ALL\n\n SELECT\n sales_partner,\n base_net_total,\n total_commission,\n amount_eligible_for_commission\n FROM\n `tabPOS Invoice`\n WHERE\n docstatus = 1\n AND IFNULL(base_net_total, 0) > 0\n AND IFNULL(total_commission, 0) > 0\n ) AS sub\nGROUP BY\n sales_partner\nORDER BY\n \"Total Commission:Currency:120\"",
|
||||||
"ref_doctype": "Sales Invoice",
|
"ref_doctype": "Sales Invoice",
|
||||||
"report_name": "Sales Partners Commission",
|
"report_name": "Sales Partners Commission",
|
||||||
"report_type": "Query Report",
|
"report_type": "Query Report",
|
||||||
@@ -26,5 +27,6 @@
|
|||||||
{
|
{
|
||||||
"role": "Accounts User"
|
"role": "Accounts User"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
}
|
"timeout": 0
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ frappe.query_reports["Sales Partner Commission Summary"] = {
|
|||||||
fieldname: "doctype",
|
fieldname: "doctype",
|
||||||
label: __("Document Type"),
|
label: __("Document Type"),
|
||||||
fieldtype: "Select",
|
fieldtype: "Select",
|
||||||
options: "Sales Order\nDelivery Note\nSales Invoice",
|
options: "Sales Order\nDelivery Note\nSales Invoice\nPOS Invoice",
|
||||||
default: "Sales Order",
|
default: "Sales Order",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,4 +106,7 @@ def get_conditions(filters, date_field):
|
|||||||
if filters.get("to_date"):
|
if filters.get("to_date"):
|
||||||
conditions += f" and {date_field} <= %(to_date)s"
|
conditions += f" and {date_field} <= %(to_date)s"
|
||||||
|
|
||||||
|
if filters.get("doctype") == "Sales Invoice":
|
||||||
|
conditions += " and not (is_consolidated = 1 and is_created_using_pos = 0)"
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|||||||
@@ -248,6 +248,9 @@ def get_actual_data(filters, sales_users_or_territory_data, date_field, sales_fi
|
|||||||
net_amount = child_doc.base_net_amount
|
net_amount = child_doc.base_net_amount
|
||||||
sales_field_col = parent_doc[sales_field]
|
sales_field_col = parent_doc[sales_field]
|
||||||
|
|
||||||
|
if filters.get("doctype") == "Sales Invoice":
|
||||||
|
query = query.where(~((parent_doc.is_consolidated == 0) & (parent_doc.is_created_using_pos == 1)))
|
||||||
|
|
||||||
query = query.select(
|
query = query.select(
|
||||||
child_doc.item_group,
|
child_doc.item_group,
|
||||||
parent_doc[date_field],
|
parent_doc[date_field],
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ frappe.query_reports["Sales Partner Target Variance based on Item Group"] = {
|
|||||||
fieldname: "doctype",
|
fieldname: "doctype",
|
||||||
label: __("Document Type"),
|
label: __("Document Type"),
|
||||||
fieldtype: "Select",
|
fieldtype: "Select",
|
||||||
options: "Sales Order\nDelivery Note\nSales Invoice",
|
options: "Sales Order\nDelivery Note\nSales Invoice\nPOS Invoice",
|
||||||
default: "Sales Order",
|
default: "Sales Order",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ frappe.query_reports["Sales Partner Transaction Summary"] = {
|
|||||||
fieldname: "doctype",
|
fieldname: "doctype",
|
||||||
label: __("Document Type"),
|
label: __("Document Type"),
|
||||||
fieldtype: "Select",
|
fieldtype: "Select",
|
||||||
options: "Sales Order\nDelivery Note\nSales Invoice",
|
options: "Sales Order\nDelivery Note\nSales Invoice\nPOS Invoice",
|
||||||
default: "Sales Order",
|
default: "Sales Order",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ def get_conditions(filters, date_field):
|
|||||||
if filters.get("brand"):
|
if filters.get("brand"):
|
||||||
conditions += " and dt_item.brand = %(brand)s"
|
conditions += " and dt_item.brand = %(brand)s"
|
||||||
|
|
||||||
|
if filters.get("doctype") == "Sales Invoice":
|
||||||
|
conditions += " and not (is_consolidated = 1 and is_created_using_pos = 0)"
|
||||||
|
|
||||||
if filters.get("item_group"):
|
if filters.get("item_group"):
|
||||||
lft, rgt = frappe.get_cached_value("Item Group", filters.get("item_group"), ["lft", "rgt"])
|
lft, rgt = frappe.get_cached_value("Item Group", filters.get("item_group"), ["lft", "rgt"])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user