mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 15:12:51 +00:00
[accounts] [feature] optional checkbox for same rate validation in sales cycle
This commit is contained in:
@@ -558,13 +558,14 @@ class DocType(SellingController):
|
|||||||
|
|
||||||
def validate_rate_with_refdoc(self):
|
def validate_rate_with_refdoc(self):
|
||||||
"""Validate values with reference document with previous document"""
|
"""Validate values with reference document with previous document"""
|
||||||
for d in self.doclist.get({"parentfield": "entries"}):
|
if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
|
||||||
if d.so_detail:
|
for d in self.doclist.get({"parentfield": "entries"}):
|
||||||
self.check_value("Sales Order", d.sales_order, d.so_detail,
|
if d.so_detail:
|
||||||
d.export_rate, d.item_code)
|
self.check_value("Sales Order", d.sales_order, d.so_detail,
|
||||||
if d.dn_detail:
|
d.export_rate, d.item_code)
|
||||||
self.check_value("Delivery Note", d.delivery_note, d.dn_detail,
|
if d.dn_detail:
|
||||||
d.export_rate, d.item_code)
|
self.check_value("Delivery Note", d.delivery_note, d.dn_detail,
|
||||||
|
d.export_rate, d.item_code)
|
||||||
|
|
||||||
def check_value(self, ref_dt, ref_dn, ref_item_dn, val, item_code):
|
def check_value(self, ref_dt, ref_dn, ref_item_dn, val, item_code):
|
||||||
ref_val = webnotes.conn.get_value(ref_dt + " Item", ref_item_dn, "export_rate")
|
ref_val = webnotes.conn.get_value(ref_dt + " Item", ref_item_dn, "export_rate")
|
||||||
|
|||||||
9
patches/july_2013/p01_same_sales_rate_patch.py
Normal file
9
patches/july_2013/p01_same_sales_rate_patch.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
def execute():
|
||||||
|
import webnotes
|
||||||
|
webnotes.reload_doc("setup", "doctype", "global_defaults")
|
||||||
|
|
||||||
|
from webnotes.model.code import get_obj
|
||||||
|
gd = get_obj('Global Defaults')
|
||||||
|
gd.doc.maintain_same_sales_rate = 1
|
||||||
|
gd.doc.save()
|
||||||
|
gd.on_update()
|
||||||
@@ -246,4 +246,5 @@ patch_list = [
|
|||||||
"execute:webnotes.reload_doc('accounts', 'DocType Mapper', 'Purchase Order-Purchase Invoice') # 2013-07-04 3:00",
|
"execute:webnotes.reload_doc('accounts', 'DocType Mapper', 'Purchase Order-Purchase Invoice') # 2013-07-04 3:00",
|
||||||
"execute:webnotes.reload_doc('accounts', 'DocType Mapper', 'Purchase Receipt-Purchase Invoice') # 2013-07-04 3:00",
|
"execute:webnotes.reload_doc('accounts', 'DocType Mapper', 'Purchase Receipt-Purchase Invoice') # 2013-07-04 3:00",
|
||||||
"execute:webnotes.delete_doc('Report', 'Sales Orders Pending To Be Delivered')",
|
"execute:webnotes.delete_doc('Report', 'Sales Orders Pending To Be Delivered')",
|
||||||
|
"patches.july_2013.p01_same_sales_rate_patch",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ keydict = {
|
|||||||
'disable_rounded_total': 'disable_rounded_total',
|
'disable_rounded_total': 'disable_rounded_total',
|
||||||
"update_stock": "update_stock",
|
"update_stock": "update_stock",
|
||||||
"auto_inventory_accounting": "auto_inventory_accounting",
|
"auto_inventory_accounting": "auto_inventory_accounting",
|
||||||
|
'maintain_same_sales_rate' : 'maintain_same_sales_rate',
|
||||||
}
|
}
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-05-02 17:53:24",
|
"creation": "2013-07-16 18:18:01",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-05-22 15:57:26",
|
"modified": "2013-07-16 18:23:52",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@@ -27,8 +27,6 @@
|
|||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
@@ -439,6 +437,12 @@
|
|||||||
"label": "Disable Rounded Total",
|
"label": "Disable Rounded Total",
|
||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "maintain_same_sales_rate",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Maintain same rate throughout sales cycle"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "buying",
|
"fieldname": "buying",
|
||||||
@@ -526,6 +530,11 @@
|
|||||||
"label": "SMS Sender Name",
|
"label": "SMS Sender Name",
|
||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
|
"doctype": "DocPerm"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm"
|
"doctype": "DocPerm"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user