mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-02 21:18:27 +00:00
fix: add remarks to sales invoice
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
import frappe.defaults
|
||||
from frappe.utils import cint, flt, add_months, today, date_diff, getdate, add_days, cstr, nowdate
|
||||
from frappe.utils import cint, flt, add_months, today, date_diff, getdate, add_days, cstr, nowdate, formatdate
|
||||
from frappe import _, msgprint, throw
|
||||
from erpnext.accounts.party import get_party_account, get_due_date
|
||||
from erpnext.controllers.stock_controller import update_gl_entries_after
|
||||
@@ -530,7 +530,12 @@ class SalesInvoice(SellingController):
|
||||
self.against_income_account = ','.join(against_acc)
|
||||
|
||||
def add_remarks(self):
|
||||
if not self.remarks: self.remarks = 'No Remarks'
|
||||
if not self.remarks:
|
||||
if self.po_no and self.po_date:
|
||||
self.remarks = _("Against Customer Order {0} dated {1}").format(self.po_no,
|
||||
formatdate(self.po_date))
|
||||
else:
|
||||
self.remarks = _("No Remarks")
|
||||
|
||||
def validate_auto_set_posting_time(self):
|
||||
# Don't auto set the posting date and time if invoice is amended
|
||||
|
||||
@@ -677,4 +677,5 @@ erpnext.patches.v12_0.set_multi_uom_in_rfq
|
||||
erpnext.patches.v12_0.update_state_code_for_daman_and_diu
|
||||
erpnext.patches.v12_0.rename_lost_reason_detail
|
||||
erpnext.patches.v12_0.update_leave_application_status
|
||||
erpnext.patches.v12_0.update_payment_entry_status
|
||||
erpnext.patches.v12_0.update_payment_entry_status
|
||||
erpnext.patches.v12_0.update_sales_invoice_remarks
|
||||
35
erpnext/patches/v12_0/update_sales_invoice_remarks.py
Normal file
35
erpnext/patches/v12_0/update_sales_invoice_remarks.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from __future__ import unicode_literals
|
||||
from mmap import PAGESIZE
|
||||
import frappe
|
||||
|
||||
from frappe import _
|
||||
from frappe.utils import formatdate
|
||||
|
||||
def execute():
|
||||
si_list = frappe.db.get_all('Sales Invoice', filters = {
|
||||
'docstatus': 1,
|
||||
'remarks': 'No Remarks',
|
||||
'po_no' : ['!=', ''],
|
||||
'po_date' : ['!=', '']
|
||||
},
|
||||
fields = ['name', 'po_no', 'po_date']
|
||||
)
|
||||
|
||||
for doc in si_list:
|
||||
remarks = _("Against Customer Order {0} dated {1}").format(doc.po_no,
|
||||
formatdate(doc.po_date))
|
||||
|
||||
frappe.db.set_value('Sales Invoice', doc.name, 'remarks', remarks)
|
||||
|
||||
gl_entry_list = frappe.db.get_all('GL Entry', filters = {
|
||||
'voucher_type': 'Sales Invoice',
|
||||
'remarks': 'No Remarks',
|
||||
'voucher_no' : doc.name
|
||||
},
|
||||
fields = ['name']
|
||||
)
|
||||
|
||||
for entry in gl_entry_list:
|
||||
frappe.db.set_value('GL Entry', entry.name, 'remarks', remarks)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user