[fix] maintain same rate throughout purchase cycle optional

This commit is contained in:
Nabin Hait 2013-07-29 11:24:11 +05:30
parent 2166b24abb
commit 173e874610
2 changed files with 28 additions and 5 deletions

View File

@ -195,8 +195,7 @@ class DocType(BuyingController):
},
"Purchase Order Item": {
"ref_dn_field": "po_detail",
"compare_fields": [["import_rate", "="], ["project_name", "="], ["item_code", "="],
["uom", "="]],
"compare_fields": [["project_name", "="], ["item_code", "="], ["uom", "="]],
"is_child_table": True
},
"Purchase Receipt": {
@ -205,11 +204,25 @@ class DocType(BuyingController):
},
"Purchase Receipt Item": {
"ref_dn_field": "pr_detail",
"compare_fields": [["import_rate", "="], ["project_name", "="], ["item_code", "="],
["uom", "="]],
"compare_fields": [["project_name", "="], ["item_code", "="], ["uom", "="]],
"is_child_table": True
}
})
if cint(webnotes.defaults.get_global_default('maintain_same_rate')):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Purchase Order Item": {
"ref_dn_field": "po_detail",
"compare_fields": [["import_rate", "="]],
"is_child_table": True
},
"Purchase Receipt Item": {
"ref_dn_field": "pr_detail",
"compare_fields": [["import_rate", "="]],
"is_child_table": True
}
})
def set_aging_date(self):
if self.doc.is_opening != 'Yes':

View File

@ -94,11 +94,21 @@ class DocType(BuyingController):
},
"Purchase Order Item": {
"ref_dn_field": "prevdoc_detail_docname",
"compare_fields": [["import_rate", "="], ["project_name", "="], ["warehouse", "="],
"compare_fields": [["project_name", "="], ["warehouse", "="],
["uom", "="], ["item_code", "="]],
"is_child_table": True
}
})
if cint(webnotes.defaults.get_global_default('maintain_same_rate')):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Purchase Order Item": {
"ref_dn_field": "prevdoc_detail_docname",
"compare_fields": [["import_rate", "="]],
"is_child_table": True
}
})
def po_required(self):
if webnotes.conn.get_single_value("Buying Settings", "po_required") == 'Yes':