fix: assigning values to rows in sales register reports (#26546)
* fix: assigning values to rows in sales register reports * fix: check for is_internal_customer for unrealized_profit_loss_account
This commit is contained in:
parent
44434ff70f
commit
ecd6584c50
@ -1934,6 +1934,7 @@
|
|||||||
"description": "Unrealized Profit / Loss account for intra-company transfers",
|
"description": "Unrealized Profit / Loss account for intra-company transfers",
|
||||||
"fieldname": "unrealized_profit_loss_account",
|
"fieldname": "unrealized_profit_loss_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"ignore_user_permissions": 1,
|
||||||
"label": "Unrealized Profit / Loss Account",
|
"label": "Unrealized Profit / Loss Account",
|
||||||
"options": "Account"
|
"options": "Account"
|
||||||
},
|
},
|
||||||
|
@ -76,7 +76,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
|||||||
'company': d.company,
|
'company': d.company,
|
||||||
'sales_order': d.sales_order,
|
'sales_order': d.sales_order,
|
||||||
'delivery_note': d.delivery_note,
|
'delivery_note': d.delivery_note,
|
||||||
'income_account': d.unrealized_profit_loss_account or d.income_account,
|
'income_account': d.unrealized_profit_loss_account if d.is_internal_customer == 1 else d.income_account,
|
||||||
'cost_center': d.cost_center,
|
'cost_center': d.cost_center,
|
||||||
'stock_qty': d.stock_qty,
|
'stock_qty': d.stock_qty,
|
||||||
'stock_uom': d.stock_uom
|
'stock_uom': d.stock_uom
|
||||||
@ -380,6 +380,7 @@ def get_items(filters, additional_query_columns):
|
|||||||
`tabSales Invoice Item`.name, `tabSales Invoice Item`.parent,
|
`tabSales Invoice Item`.name, `tabSales Invoice Item`.parent,
|
||||||
`tabSales Invoice`.posting_date, `tabSales Invoice`.debit_to,
|
`tabSales Invoice`.posting_date, `tabSales Invoice`.debit_to,
|
||||||
`tabSales Invoice`.unrealized_profit_loss_account,
|
`tabSales Invoice`.unrealized_profit_loss_account,
|
||||||
|
`tabSales Invoice`.is_internal_customer,
|
||||||
`tabSales Invoice`.project, `tabSales Invoice`.customer, `tabSales Invoice`.remarks,
|
`tabSales Invoice`.project, `tabSales Invoice`.customer, `tabSales Invoice`.remarks,
|
||||||
`tabSales Invoice`.territory, `tabSales Invoice`.company, `tabSales Invoice`.base_net_total,
|
`tabSales Invoice`.territory, `tabSales Invoice`.company, `tabSales Invoice`.base_net_total,
|
||||||
`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.description,
|
`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.description,
|
||||||
|
@ -84,7 +84,7 @@ def _execute(filters, additional_table_columns=None, additional_query_columns=No
|
|||||||
# Add amount in unrealized account
|
# Add amount in unrealized account
|
||||||
for account in unrealized_profit_loss_accounts:
|
for account in unrealized_profit_loss_accounts:
|
||||||
row.update({
|
row.update({
|
||||||
frappe.scrub(account): flt(internal_invoice_map.get((inv.name, account)))
|
frappe.scrub(account+"_unrealized"): flt(internal_invoice_map.get((inv.name, account)))
|
||||||
})
|
})
|
||||||
|
|
||||||
# net total
|
# net total
|
||||||
@ -258,6 +258,7 @@ def get_columns(invoice_list, additional_table_columns):
|
|||||||
|
|
||||||
unrealized_profit_loss_accounts = frappe.db.sql_list("""SELECT distinct unrealized_profit_loss_account
|
unrealized_profit_loss_accounts = frappe.db.sql_list("""SELECT distinct unrealized_profit_loss_account
|
||||||
from `tabSales Invoice` where docstatus = 1 and name in (%s)
|
from `tabSales Invoice` where docstatus = 1 and name in (%s)
|
||||||
|
and is_internal_customer = 1
|
||||||
and ifnull(unrealized_profit_loss_account, '') != ''
|
and ifnull(unrealized_profit_loss_account, '') != ''
|
||||||
order by unrealized_profit_loss_account""" %
|
order by unrealized_profit_loss_account""" %
|
||||||
', '.join(['%s']*len(invoice_list)), tuple(inv.name for inv in invoice_list))
|
', '.join(['%s']*len(invoice_list)), tuple(inv.name for inv in invoice_list))
|
||||||
@ -284,7 +285,7 @@ def get_columns(invoice_list, additional_table_columns):
|
|||||||
for account in unrealized_profit_loss_accounts:
|
for account in unrealized_profit_loss_accounts:
|
||||||
unrealized_profit_loss_account_columns.append({
|
unrealized_profit_loss_account_columns.append({
|
||||||
"label": account,
|
"label": account,
|
||||||
"fieldname": frappe.scrub(account),
|
"fieldname": frappe.scrub(account+"_unrealized"),
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"options": "currency",
|
"options": "currency",
|
||||||
"width": 120
|
"width": 120
|
||||||
|
Loading…
x
Reference in New Issue
Block a user