Merge pull request #2934 from nabinhait/develop

Pricing Rule Issue
This commit is contained in:
Nabin Hait 2015-03-09 15:31:37 +05:30
commit 7d5a2390dd
3 changed files with 9 additions and 7 deletions

View File

@ -18,17 +18,17 @@ class CForm(Document):
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
if inv and inv[0][0] != 'Yes':
frappe.throw("C-form is not applicable for Invoice: %s" % d.invoice_no)
frappe.throw("C-form is not applicable for Invoice: {0}".format(d.invoice_no))
elif inv and inv[0][1] and inv[0][1] != self.name:
frappe.throw("""Invoice %s is tagged in another C-form: %s.
frappe.throw("""Invoice {0} is tagged in another C-form: {1}.
If you want to change C-form no for this invoice,
please remove invoice no from the previous c-form and then try again""" %
(d.invoice_no, inv[0][1]))
please remove invoice no from the previous c-form and then try again"""\
.format(d.invoice_no, inv[0][1]))
elif not inv:
frappe.throw("Row %s: Invoice %s is invalid, it might be cancelled / does not exist. \
Please enter a valid Invoice" % d.idx, d.invoice_no)
frappe.throw("Row {0}: Invoice {1} is invalid, it might be cancelled / does not exist. \
Please enter a valid Invoice".format(d.idx, d.invoice_no))
def on_update(self):
""" Update C-Form No on invoices"""

View File

@ -112,6 +112,8 @@ class AccountsController(TransactionBase):
if item.get("item_code"):
args = parent_dict.copy()
args.update(item.as_dict())
if not args.get("transaction_date"):
args["transaction_date"] = args.get("posting_date")
ret = get_item_details(args)
for fieldname, value in ret.items():

View File

@ -148,7 +148,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
order_type: me.frm.doc.order_type,
is_pos: cint(me.frm.doc.is_pos),
is_subcontracted: me.frm.doc.is_subcontracted,
transaction_date: me.frm.doc.transaction_date,
transaction_date: me.frm.doc.transaction_date || me.frm.doc.posting_date,
ignore_pricing_rule: me.frm.doc.ignore_pricing_rule,
doctype: item.doctype,
name: item.name,