From 3a2fcba15f1c0d1d0622d8c5191ba8e97ceb2240 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 14 Dec 2011 11:26:46 +0530 Subject: [PATCH] Purchase Discount option in Features Setup --- erpnext/patches/Discount_purchase_cycle.py | 5 +++++ erpnext/patches/reload_rv.py | 1 + .../doctype/features_setup/features_setup.py | 1 - .../doctype/features_setup/features_setup.txt | 18 ++++++++++++++---- erpnext/startup/startup.js | 5 +++++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/erpnext/patches/Discount_purchase_cycle.py b/erpnext/patches/Discount_purchase_cycle.py index f786439b5d..34fd49827f 100755 --- a/erpnext/patches/Discount_purchase_cycle.py +++ b/erpnext/patches/Discount_purchase_cycle.py @@ -7,3 +7,8 @@ def execute(): reload_doc('stock', 'doctype', 'purchase_receipt_detail') if webnotes.conn.sql("select name from `tabDocField` where parent = 'PO Detail' and fieldname = 'discount'"): webnotes.conn.sql("update `tabPO Detail` set discount_rate=discount") + + # Features setup + reload_doc('setup', 'doctype', 'features_setup') + from webnotes.model.code import get_obj + get_obj('Features Setup').validate() diff --git a/erpnext/patches/reload_rv.py b/erpnext/patches/reload_rv.py index 5f3bc210ae..7b47b4c0d6 100644 --- a/erpnext/patches/reload_rv.py +++ b/erpnext/patches/reload_rv.py @@ -5,4 +5,5 @@ def execute(): reload_doc('accounts', 'doctype', 'receivable_voucher') + reload_doc('setup', 'doctype', 'features_setup') get_obj('Features setup').validate() diff --git a/erpnext/setup/doctype/features_setup/features_setup.py b/erpnext/setup/doctype/features_setup/features_setup.py index f12d2824fd..3a549d9e32 100644 --- a/erpnext/setup/doctype/features_setup/features_setup.py +++ b/erpnext/setup/doctype/features_setup/features_setup.py @@ -8,7 +8,6 @@ class DocType: """ from webnotes.model import default_fields from webnotes.utils import set_default - for key in self.doc.fields: if key not in default_fields: set_default(key, self.doc.fields[key]) diff --git a/erpnext/setup/doctype/features_setup/features_setup.txt b/erpnext/setup/doctype/features_setup/features_setup.txt index d0f02d576d..a7c6fe81ee 100644 --- a/erpnext/setup/doctype/features_setup/features_setup.txt +++ b/erpnext/setup/doctype/features_setup/features_setup.txt @@ -5,14 +5,14 @@ { 'creation': '2011-09-07 11:59:05', 'docstatus': 0, - 'modified': '2011-12-06 18:48:53', + 'modified': '2011-12-14 11:05:55', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1323176623', + '_last_update': '1323840127', 'colour': 'White:FFF', 'default_print_format': 'Standard', 'doctype': 'DocType', @@ -22,7 +22,7 @@ 'name_case': 'Title Case', 'section_style': 'Simple', 'show_in_menu': 1, - 'version': 24 + 'version': 26 }, # These values are common for all DocField @@ -179,7 +179,17 @@ 'doctype': 'DocField', 'fieldname': 'fs_discounts', 'fieldtype': 'Check', - 'label': 'Discounts' + 'label': 'Sales Discounts' + }, + + # DocField + { + 'colour': 'White:FFF', + 'description': 'Discount Fields will be available in Purchase Order, Purchase Receipt, Purchase Invoice', + 'doctype': 'DocField', + 'fieldname': 'fs_purchase_discounts', + 'fieldtype': 'Check', + 'label': 'Purchase Discounts' }, # DocField diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 291265b3bd..07c1629f83 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -572,6 +572,11 @@ pscript.feature_dict = { 'Receivable Voucher': {'entries':['adj_rate']}, 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']} }, + 'fs_purchase_discounts': { + 'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, + 'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, + 'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']} + }, 'fs_brands': { 'Delivery Note': {'delivery_note_details':['brand']}, 'Indent': {'indent_details':['brand']},