mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 11:39:18 +00:00
fix: add remarks to sales invoice
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, erpnext
|
import frappe, erpnext
|
||||||
import frappe.defaults
|
import frappe.defaults
|
||||||
from frappe.utils import cint, flt, add_months, today, date_diff, getdate, add_days, cstr, nowdate, get_link_to_form
|
from frappe.utils import cint, flt, getdate, add_days, cstr, nowdate, get_link_to_form, formatdate
|
||||||
from frappe import _, msgprint, throw
|
from frappe import _, msgprint, throw
|
||||||
from erpnext.accounts.party import get_party_account, get_due_date
|
from erpnext.accounts.party import get_party_account, get_due_date
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
@@ -535,7 +535,12 @@ class SalesInvoice(SellingController):
|
|||||||
self.against_income_account = ','.join(against_acc)
|
self.against_income_account = ','.join(against_acc)
|
||||||
|
|
||||||
def add_remarks(self):
|
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):
|
def validate_auto_set_posting_time(self):
|
||||||
# Don't auto set the posting date and time if invoice is amended
|
# Don't auto set the posting date and time if invoice is amended
|
||||||
|
|||||||
@@ -735,3 +735,4 @@ erpnext.patches.v13_0.create_healthcare_custom_fields_in_stock_entry_detail
|
|||||||
erpnext.patches.v13_0.update_reason_for_resignation_in_employee
|
erpnext.patches.v13_0.update_reason_for_resignation_in_employee
|
||||||
erpnext.patches.v13_0.update_custom_fields_for_shopify
|
erpnext.patches.v13_0.update_custom_fields_for_shopify
|
||||||
execute:frappe.delete_doc("Report", "Quoted Item Comparison")
|
execute:frappe.delete_doc("Report", "Quoted Item Comparison")
|
||||||
|
erpnext.patches.v12_0.update_sales_invoice_remarks
|
||||||
32
erpnext/patches/v12_0/update_sales_invoice_remarks.py
Normal file
32
erpnext/patches/v12_0/update_sales_invoice_remarks.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
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