fix: POS Closing Entry without linked invoices (#28042)

This commit is contained in:
Subin Tom 2021-10-25 13:18:08 +05:30 committed by GitHub
parent fdaf93f76c
commit fc8307621c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -180,8 +180,7 @@
"fieldname": "pos_transactions", "fieldname": "pos_transactions",
"fieldtype": "Table", "fieldtype": "Table",
"label": "POS Transactions", "label": "POS Transactions",
"options": "POS Invoice Reference", "options": "POS Invoice Reference"
"reqd": 1
}, },
{ {
"fieldname": "pos_opening_entry", "fieldname": "pos_opening_entry",
@ -229,7 +228,7 @@
"link_fieldname": "pos_closing_entry" "link_fieldname": "pos_closing_entry"
} }
], ],
"modified": "2021-05-05 16:59:49.723261", "modified": "2021-10-20 16:19:25.340565",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Closing Entry", "name": "POS Closing Entry",

View File

@ -246,7 +246,10 @@ def get_invoice_customer_map(pos_invoices):
return pos_invoice_customer_map return pos_invoice_customer_map
def consolidate_pos_invoices(pos_invoices=None, closing_entry=None): def consolidate_pos_invoices(pos_invoices=None, closing_entry=None):
invoices = pos_invoices or (closing_entry and closing_entry.get('pos_transactions')) or get_all_unconsolidated_invoices() invoices = pos_invoices or (closing_entry and closing_entry.get('pos_transactions'))
if frappe.flags.in_test and not invoices:
invoices = get_all_unconsolidated_invoices()
invoice_by_customer = get_invoice_customer_map(invoices) invoice_by_customer = get_invoice_customer_map(invoices)
if len(invoices) >= 10 and closing_entry: if len(invoices) >= 10 and closing_entry: