Maintain same rate throughout pur cycle: in global defaults, by default set true
This commit is contained in:
parent
cba9c716f2
commit
b695f73293
@ -300,18 +300,14 @@ class DocType(TransactionBase):
|
||||
supplier = ''
|
||||
if d.purchase_order and not d.purchase_order in self.po_list:
|
||||
supplier = sql("select supplier from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0]
|
||||
doctype = 'purchase order'
|
||||
doctype_no = cstr(d.purchase_order)
|
||||
if supplier and not cstr(self.doc.supplier) == cstr(supplier):
|
||||
msgprint("Supplier name %s do not match with supplier name of %s %s." %(self.doc.supplier,doctype,doctype_no))
|
||||
msgprint("Supplier name %s do not match with supplier name of purhase order: %s." %(self.doc.supplier,cstr(d.purchase_order)))
|
||||
raise Exception , " Validation Error "
|
||||
|
||||
if d.purchase_receipt and not d.purchase_receipt in self.pr_list:
|
||||
supplier = sql("select supplier from `tabPurchase Receipt` where name = '%s'" % d.purchase_receipt)[0][0]
|
||||
doctype = 'purchase receipt'
|
||||
doctype_no = cstr(d.purchase_receipt)
|
||||
if supplier and not cstr(self.doc.supplier) == cstr(supplier):
|
||||
msgprint("Supplier name %s do not match with supplier name of %s %s." %(self.doc.supplier,doctype,doctype_no))
|
||||
msgprint("Supplier name %s do not match with supplier name of %s %s." %(self.doc.supplier,cstr(d.purchase_receipt)))
|
||||
raise Exception , " Validation Error "
|
||||
|
||||
# Validate values with reference document
|
||||
@ -325,7 +321,7 @@ class DocType(TransactionBase):
|
||||
def validate_po_pr(self, d):
|
||||
# check po / pr for qty and rates and currency and conversion rate
|
||||
|
||||
# always import_rate must be equal to import_rate of purchase order
|
||||
# currency, import_rate must be equal to currency, import_rate of purchase order
|
||||
if d.purchase_order and not d.purchase_order in self.po_list:
|
||||
# currency
|
||||
currency = cstr(sql("select currency from `tabPurchase Order` where name = '%s'" % d.purchase_order)[0][0])
|
||||
@ -334,7 +330,7 @@ class DocType(TransactionBase):
|
||||
raise Exception
|
||||
# import_rate
|
||||
rate = flt(sql('select import_rate from `tabPurchase Order Item` where item_code=%s and parent=%s and name = %s', (d.item_code, d.purchase_order, d.po_detail))[0][0])
|
||||
if abs(rate - flt(d.import_rate)) > 1:
|
||||
if abs(rate - flt(d.import_rate)) > 1 and cint(get_defaults('maintain_same_rate')):
|
||||
msgprint("Import Rate for %s in the Purchase Order is %s. Rate must be same as Purchase Order Rate" % (d.item_code,rate))
|
||||
raise Exception
|
||||
|
||||
|
7
erpnext/patches/may_2012/same_purchase_rate_patch.py
Normal file
7
erpnext/patches/may_2012/same_purchase_rate_patch.py
Normal file
@ -0,0 +1,7 @@
|
||||
def execute():
|
||||
import webnotes
|
||||
gd = webnotes.model.code.get_obj('Global Defaults')
|
||||
gd.doc.maintain_same_rate = 1
|
||||
gd.doc.save()
|
||||
gd.on_update()
|
||||
|
@ -372,5 +372,9 @@ patch_list = [
|
||||
'patch_file': 'clear_session_cache',
|
||||
'description': 'clears session cache as shifting to json format'
|
||||
},
|
||||
|
||||
{
|
||||
'patch_module': 'patches.may_2012',
|
||||
'patch_file': 'same_purchase_rate_patch',
|
||||
'description': 'Main same rate throughout pur cycle: in global defaults, by default set true'
|
||||
},
|
||||
]
|
@ -35,7 +35,8 @@ keydict = {
|
||||
'date_format': 'date_format',
|
||||
'currency_format':'default_currency_format',
|
||||
'account_url':'account_url',
|
||||
'allow_negative_stock' : 'allow_negative_stock'
|
||||
'allow_negative_stock' : 'allow_negative_stock',
|
||||
'maintain_same_rate' : 'maintain_same_rate'
|
||||
}
|
||||
|
||||
class DocType:
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-04-18 17:00:50',
|
||||
'creation': '2012-04-20 14:02:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-04-19 17:24:45',
|
||||
'modified': '2012-05-22 14:11:21',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -224,8 +224,8 @@
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Default Valuation Method',
|
||||
'options': u'FIFO\nMoving Average'
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
@ -508,6 +508,14 @@
|
||||
'options': u'No\nYes'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'maintain_same_rate',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Maintain same rate throughout purchase cycle'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -543,4 +551,4 @@
|
||||
'fieldtype': u'Data',
|
||||
'label': u'SMS Sender Name'
|
||||
}
|
||||
]
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user