fix(pos): error while merging pos invoices into sales invoice (#24337)
This commit is contained in:
parent
adb8bbe958
commit
d43bb4db41
@ -57,7 +57,11 @@ class POSClosingEntry(Document):
|
|||||||
if not invalid_rows:
|
if not invalid_rows:
|
||||||
return
|
return
|
||||||
|
|
||||||
error_list = [_("Row #{}: {}").format(row.get('idx'), row.get('msg')) for row in invalid_rows]
|
error_list = []
|
||||||
|
for row in invalid_rows:
|
||||||
|
for msg in row.get('msg'):
|
||||||
|
error_list.append(_("Row #{}: {}").format(row.get('idx'), msg))
|
||||||
|
|
||||||
frappe.throw(error_list, title=_("Invalid POS Invoices"), as_list=True)
|
frappe.throw(error_list, title=_("Invalid POS Invoices"), as_list=True)
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import cint, flt, add_months, today, date_diff, getdate, add_days, cstr, nowdate
|
|
||||||
from frappe.model.document import Document
|
|
||||||
from frappe.model.mapper import map_doc
|
|
||||||
from frappe.model import default_fields
|
from frappe.model import default_fields
|
||||||
|
from frappe.model.document import Document
|
||||||
|
from frappe.model.mapper import map_doc, map_child_doc
|
||||||
|
from frappe.utils import cint, flt, add_months, today, date_diff, getdate, add_days, cstr, nowdate
|
||||||
|
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ class POSInvoiceMergeLog(Document):
|
|||||||
|
|
||||||
credit_note.is_consolidated = 1
|
credit_note.is_consolidated = 1
|
||||||
# TODO: return could be against multiple sales invoice which could also have been consolidated?
|
# TODO: return could be against multiple sales invoice which could also have been consolidated?
|
||||||
credit_note.return_against = self.consolidated_invoice
|
# credit_note.return_against = self.consolidated_invoice
|
||||||
credit_note.save()
|
credit_note.save()
|
||||||
credit_note.submit()
|
credit_note.submit()
|
||||||
self.consolidated_credit_note = credit_note.name
|
self.consolidated_credit_note = credit_note.name
|
||||||
@ -111,7 +111,8 @@ class POSInvoiceMergeLog(Document):
|
|||||||
i.qty = i.qty + item.qty
|
i.qty = i.qty + item.qty
|
||||||
if not found:
|
if not found:
|
||||||
item.rate = item.net_rate
|
item.rate = item.net_rate
|
||||||
items.append(item)
|
si_item = map_child_doc(item, invoice, {"doctype": "Sales Invoice Item"})
|
||||||
|
items.append(si_item)
|
||||||
|
|
||||||
for tax in doc.get('taxes'):
|
for tax in doc.get('taxes'):
|
||||||
found = False
|
found = False
|
||||||
|
|||||||
@ -262,6 +262,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
|
|||||||
|
|
||||||
if doc.get("is_return"):
|
if doc.get("is_return"):
|
||||||
if doc.doctype == 'Sales Invoice' or doc.doctype == 'POS Invoice':
|
if doc.doctype == 'Sales Invoice' or doc.doctype == 'POS Invoice':
|
||||||
|
doc.consolidated_invoice = ""
|
||||||
doc.set('payments', [])
|
doc.set('payments', [])
|
||||||
for data in source.payments:
|
for data in source.payments:
|
||||||
paid_amount = 0.00
|
paid_amount = 0.00
|
||||||
|
|||||||
@ -743,3 +743,4 @@ erpnext.patches.v13_0.updates_for_multi_currency_payroll
|
|||||||
erpnext.patches.v13_0.create_leave_policy_assignment_based_on_employee_current_leave_policy
|
erpnext.patches.v13_0.create_leave_policy_assignment_based_on_employee_current_leave_policy
|
||||||
erpnext.patches.v13_0.add_po_to_global_search
|
erpnext.patches.v13_0.add_po_to_global_search
|
||||||
erpnext.patches.v13_0.update_returned_qty_in_pr_dn
|
erpnext.patches.v13_0.update_returned_qty_in_pr_dn
|
||||||
|
erpnext.patches.v13_0.create_uae_pos_invoice_fields
|
||||||
14
erpnext/patches/v13_0/create_uae_pos_invoice_fields.py
Normal file
14
erpnext/patches/v13_0/create_uae_pos_invoice_fields.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Copyright (c) 2019, Frappe and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
from erpnext.regional.united_arab_emirates.setup import make_custom_fields
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
company = frappe.get_all('Company', filters = {'country': ['in', ['Saudi Arabia', 'United Arab Emirates']]})
|
||||||
|
if not company:
|
||||||
|
return
|
||||||
|
|
||||||
|
make_custom_fields()
|
||||||
Loading…
x
Reference in New Issue
Block a user