From ceb9f41f15c20a40865c87189834161e121d9592 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Mar 2012 17:04:32 +0530 Subject: [PATCH] lead organization fld added in quotation for printing: patch --- .../doctype/payable_voucher/payable_voucher.py | 11 +++++++++-- erpnext/patches/jan_mar_2012/reload_quote.py | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/reload_quote.py diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.py b/erpnext/accounts/doctype/payable_voucher/payable_voucher.py index 1a09a451c78..d9305835366 100644 --- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.py +++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.py @@ -123,7 +123,10 @@ class DocType(TransactionBase): def get_pv_details(self, arg): import json - item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center from tabItem where name=%s",arg,as_dict=1) + item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center, last_purchase_rate from tabItem where name=%s",arg,as_dict=1) + lpr = item_det and flt(item_det[0]['last_purchase_rate']) or 0 + import_lpr = lpr / flt(self.doc.conversion_rate) or 1 + tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg) t = {} for x in tax: t[x[0]] = flt(x[1]) @@ -132,13 +135,17 @@ class DocType(TransactionBase): 'brand' : item_det and item_det[0]['brand'] or '', 'description' : item_det and item_det[0]['description'] or '', 'item_group' : item_det and item_det[0]['item_group'] or '', - 'rate' : 0.00, + 'rate' : lpr, + 'purchase_ref_rate' : lpr, + 'import_ref_rate' : import_lpr, + 'import_rate' : import_lpr, 'qty' : 0.00, 'amount' : 0.00, 'expense_head' : item_det and item_det[0]['purchase_account'] or '', 'cost_center' : item_det and item_det[0]['cost_center'] or '', 'item_tax_rate' : json.dumps(t) } + return ret diff --git a/erpnext/patches/jan_mar_2012/reload_quote.py b/erpnext/patches/jan_mar_2012/reload_quote.py new file mode 100644 index 00000000000..5715bb4efb5 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/reload_quote.py @@ -0,0 +1,4 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + reload_doc('selling', 'doctype', 'quotation')