Merge pull request #6229 from rohitwaghchaure/pos_payment_issue
[POS] Fixed POS Sales Invoice when Payment Table is Empty
This commit is contained in:
commit
bb2bceef62
File diff suppressed because it is too large
Load Diff
@ -89,6 +89,8 @@ class SalesInvoice(SellingController):
|
||||
set_account_for_mode_of_payment(self)
|
||||
|
||||
def on_submit(self):
|
||||
self.validate_pos_paid_amount()
|
||||
|
||||
if not self.recurring_id:
|
||||
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
|
||||
self.company, self.base_grand_total, self)
|
||||
@ -121,6 +123,10 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.update_time_sheet(self.name)
|
||||
|
||||
def validate_pos_paid_amount(self):
|
||||
if len(self.payments) == 0 and self.is_pos:
|
||||
frappe.throw(_("At least one mode of payment is required for POS invoice."))
|
||||
|
||||
def before_cancel(self):
|
||||
self.update_time_sheet(None)
|
||||
|
||||
@ -248,7 +254,7 @@ class SalesInvoice(SellingController):
|
||||
from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
|
||||
pos = get_pos_profile(self.company)
|
||||
|
||||
if not self.get('payments'):
|
||||
if not self.get('payments') and not for_validate:
|
||||
pos_profile = frappe.get_doc('POS Profile', pos.name) if pos else None
|
||||
update_multi_mode_option(self, pos_profile)
|
||||
|
||||
|
@ -9,7 +9,7 @@ erpnext.patches.v4_0.move_warehouse_user_to_restrictions
|
||||
erpnext.patches.v4_0.global_defaults_to_system_settings
|
||||
erpnext.patches.v4_0.update_incharge_name_to_sales_person_in_maintenance_schedule
|
||||
execute:frappe.reload_doc('stock', 'doctype', 'warehouse')
|
||||
execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2014-01-29
|
||||
execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2016-08-31
|
||||
execute:frappe.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29
|
||||
execute:frappe.reload_doc('selling', 'doctype', 'quotation') # 2014-01-29
|
||||
execute:frappe.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-29
|
||||
@ -276,6 +276,7 @@ execute:frappe.db.sql('update tabQuotation set status="Cancelled" where docstatu
|
||||
execute:frappe.rename_doc("DocType", "Payments", "Sales Invoice Payment", force=True)
|
||||
erpnext.patches.v7_0.update_mins_to_first_response
|
||||
erpnext.patches.v6_20x.repost_valuation_rate_for_negative_inventory
|
||||
erpnext.patches.v7_0.migrate_mode_of_payments_v6_to_v7
|
||||
erpnext.patches.v7_0.system_settings_setup_complete
|
||||
erpnext.patches.v7_0.set_naming_series_for_timesheet #2016-07-27
|
||||
execute:frappe.reload_doc('projects', 'doctype', 'project')
|
||||
|
20
erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py
Normal file
20
erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py
Normal file
@ -0,0 +1,20 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('accounts', 'doctype', 'sales_invoice_timesheet')
|
||||
frappe.reload_doc('accounts', 'doctype', 'sales_invoice_payment')
|
||||
|
||||
for data in frappe.db.sql("""select name, mode_of_payment, cash_bank_account, paid_amount from
|
||||
`tabSales Invoice` where is_pos = 1 and docstatus < 2 and cash_bank_account is not null""", as_dict=1):
|
||||
si_doc = frappe.get_doc('Sales Invoice', data.name)
|
||||
si_doc.append('payments', {
|
||||
'mode_of_payment': data.mode_of_payment or 'Cash',
|
||||
'account': data.cash_bank_account,
|
||||
'type': frappe.db.get_value('Mode of Payment', data.mode_of_payment, 'type') or 'Cash',
|
||||
'amount': data.paid_amount
|
||||
})
|
||||
|
||||
si_doc.set_paid_amount()
|
||||
si_doc.flags.ignore_validate_update_after_submit = True
|
||||
si_doc.save()
|
Loading…
x
Reference in New Issue
Block a user