From b95b719994ba50691fbf40264b79d51992262bcc Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 25 Dec 2012 21:19:29 +0530 Subject: [PATCH 1/5] retro fix for support ticket module change bug --- support/doctype/support_ticket/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/doctype/support_ticket/__init__.py b/support/doctype/support_ticket/__init__.py index a53c76b939..0295e32ec7 100644 --- a/support/doctype/support_ticket/__init__.py +++ b/support/doctype/support_ticket/__init__.py @@ -81,7 +81,7 @@ class SupportMailbox(POP3Mailbox): if exists and exists[0] and exists[0][0]: st = webnotes.get_obj('Support Ticket', thread_id) - from support.doctype.communication.communication import make + from core.doctype.communication.communication import make make(content=content, sender=full_email_id, doctype="Support Ticket", name=thread_id, lead = st.doc.lead, contact=st.doc.contact) From e927a14aac04a4bddf111ab4d415037d58905dbf Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 24 Jun 2013 12:02:22 +0530 Subject: [PATCH 2/5] [fixes] pull previous doc details --- accounts/doctype/purchase_invoice/purchase_invoice.js | 2 +- stock/doctype/delivery_note/delivery_note.js | 5 +---- stock/doctype/purchase_receipt/purchase_receipt.js | 8 +++----- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js index 92f17487bc..49292c2712 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -166,7 +166,7 @@ cur_frm.cscript.recalculate = function(doc, cdt, cdn) { cur_frm.cscript.get_items = function(doc, dt, dn) { var callback = function(r,rt) { unhide_field(['supplier_address', 'contact_person']); - refresh_many(['credit_to','supplier','supplier_address','contact_person','supplier_name', 'address_display', 'contact_display','contact_mobile', 'contact_email','entries', 'purchase_receipt_main', 'purchase_order_main', 'purchase_tax_details']); + cur_frm.refresh(); } $c_obj(make_doclist(dt,dn),'pull_details','',callback); } diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js index 8d09cbd676..01556bac04 100644 --- a/stock/doctype/delivery_note/delivery_note.js +++ b/stock/doctype/delivery_note/delivery_note.js @@ -112,10 +112,7 @@ cur_frm.cscript.get_items = function(doc,dt,dn) { if(doc.sales_order_no) { unhide_field(['customer_address','contact_person','territory','customer_group']); } - - refresh_many(['delivery_note_details', 'customer', 'customer_address', - 'contact_person', 'customer_name', 'address_display', 'contact_display', - 'contact_mobile', 'contact_email', 'territory', 'customer_group']); + cur_frm.refresh(); } } $c_obj(make_doclist(doc.doctype, doc.name),'pull_sales_order_details','',callback); diff --git a/stock/doctype/purchase_receipt/purchase_receipt.js b/stock/doctype/purchase_receipt/purchase_receipt.js index 82e494cfb7..84f2aab0b9 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/stock/doctype/purchase_receipt/purchase_receipt.js @@ -102,11 +102,9 @@ cur_frm.fields_dict.contact_person.on_new = function(dn) { // Get Purchase Order Button // ----------------- cur_frm.cscript.pull_purchase_order_details = function(doc, dt, dn) { - var callback = function(r,rt) { - //unhide_field(['supplier_address','contact_person','supplier_name','address_display', 'contact_display', 'contact_mobile','contact_email']); - refresh_many(['supplier','supplier_address','contact_person', 'supplier_name', 'address_display', 'contact_display','contact_mobile', 'contact_email', 'purchase_receipt_details', 'purchase_tax_details']); - } - $c_obj(make_doclist(dt,dn),'get_po_details','',callback); + $c_obj(make_doclist(dt,dn),'get_po_details','', function(r,rt) { + cur_frm.refresh(); + }); } From a292b44df30fe9ea9d93c5f584deb52ffc9e3b49 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 24 Jun 2013 12:24:01 +0530 Subject: [PATCH 3/5] [fixes] pull previous doc details --- accounts/doctype/purchase_invoice/purchase_invoice.js | 2 +- accounts/doctype/sales_invoice/sales_invoice.js | 2 +- selling/doctype/sales_order/sales_order.js | 2 +- stock/doctype/delivery_note/delivery_note.js | 2 +- stock/doctype/purchase_receipt/purchase_receipt.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js index 49292c2712..8b7af8b9dc 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -166,7 +166,7 @@ cur_frm.cscript.recalculate = function(doc, cdt, cdn) { cur_frm.cscript.get_items = function(doc, dt, dn) { var callback = function(r,rt) { unhide_field(['supplier_address', 'contact_person']); - cur_frm.refresh(); + cur_frm.refresh_fields(); } $c_obj(make_doclist(dt,dn),'pull_details','',callback); } diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 7863306de1..2d5abd7133 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -276,7 +276,7 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) { cur_frm.cscript.get_items = function(doc, dt, dn) { var callback = function(r,rt) { unhide_field(['customer_address','contact_person', 'territory','customer_group']); - cur_frm.refresh(); + cur_frm.refresh_fields(); } get_server_fields('pull_details','','',doc, dt, dn,1,callback); } diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js index b792754384..86a6994eb9 100644 --- a/selling/doctype/sales_order/sales_order.js +++ b/selling/doctype/sales_order/sales_order.js @@ -140,7 +140,7 @@ cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) { 'contact_person', 'territory', 'customer_group']); if(doc.customer) get_server_fields('get_shipping_address', doc.customer, '', doc, dt, dn, 0); } - cur_frm.refresh(); + cur_frm.refresh_fields(); } } diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js index 01556bac04..ad39b7a822 100644 --- a/stock/doctype/delivery_note/delivery_note.js +++ b/stock/doctype/delivery_note/delivery_note.js @@ -112,7 +112,7 @@ cur_frm.cscript.get_items = function(doc,dt,dn) { if(doc.sales_order_no) { unhide_field(['customer_address','contact_person','territory','customer_group']); } - cur_frm.refresh(); + cur_frm.refresh_fields(); } } $c_obj(make_doclist(doc.doctype, doc.name),'pull_sales_order_details','',callback); diff --git a/stock/doctype/purchase_receipt/purchase_receipt.js b/stock/doctype/purchase_receipt/purchase_receipt.js index 84f2aab0b9..834b00af3f 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/stock/doctype/purchase_receipt/purchase_receipt.js @@ -103,7 +103,7 @@ cur_frm.fields_dict.contact_person.on_new = function(dn) { // ----------------- cur_frm.cscript.pull_purchase_order_details = function(doc, dt, dn) { $c_obj(make_doclist(dt,dn),'get_po_details','', function(r,rt) { - cur_frm.refresh(); + cur_frm.refresh_fields(); }); } From 6a3b9513524039bd5b99ca9ffcf25790db677138 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 16 Jul 2013 18:34:35 +0530 Subject: [PATCH 4/5] [accounts] [feature] optional checkbox for same rate validation in sales cycle --- accounts/doctype/sales_invoice/sales_invoice.py | 15 ++++++++------- patches/july_2013/p01_same_sales_rate_patch.py | 9 +++++++++ patches/patch_list.py | 1 + .../doctype/global_defaults/global_defaults.py | 1 + .../doctype/global_defaults/global_defaults.txt | 17 +++++++++++++---- 5 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 patches/july_2013/p01_same_sales_rate_patch.py diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index 956867d7ab..23114f0d78 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -558,13 +558,14 @@ class DocType(SellingController): def validate_rate_with_refdoc(self): """Validate values with reference document with previous document""" - for d in self.doclist.get({"parentfield": "entries"}): - if d.so_detail: - self.check_value("Sales Order", d.sales_order, d.so_detail, - d.export_rate, d.item_code) - if d.dn_detail: - self.check_value("Delivery Note", d.delivery_note, d.dn_detail, - d.export_rate, d.item_code) + if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')): + for d in self.doclist.get({"parentfield": "entries"}): + if d.so_detail: + self.check_value("Sales Order", d.sales_order, d.so_detail, + d.export_rate, d.item_code) + if d.dn_detail: + 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): ref_val = webnotes.conn.get_value(ref_dt + " Item", ref_item_dn, "export_rate") diff --git a/patches/july_2013/p01_same_sales_rate_patch.py b/patches/july_2013/p01_same_sales_rate_patch.py new file mode 100644 index 0000000000..cc1f6daa99 --- /dev/null +++ b/patches/july_2013/p01_same_sales_rate_patch.py @@ -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() \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 812f641fcb..d15602d799 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -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 Receipt-Purchase Invoice') # 2013-07-04 3:00", "execute:webnotes.delete_doc('Report', 'Sales Orders Pending To Be Delivered')", + "patches.july_2013.p01_same_sales_rate_patch", ] diff --git a/setup/doctype/global_defaults/global_defaults.py b/setup/doctype/global_defaults/global_defaults.py index dc7f6b4b73..a921229a16 100644 --- a/setup/doctype/global_defaults/global_defaults.py +++ b/setup/doctype/global_defaults/global_defaults.py @@ -48,6 +48,7 @@ keydict = { 'disable_rounded_total': 'disable_rounded_total', "update_stock": "update_stock", "auto_inventory_accounting": "auto_inventory_accounting", + 'maintain_same_sales_rate' : 'maintain_same_sales_rate', } class DocType: diff --git a/setup/doctype/global_defaults/global_defaults.txt b/setup/doctype/global_defaults/global_defaults.txt index 175ca9414b..1e1505a6b1 100644 --- a/setup/doctype/global_defaults/global_defaults.txt +++ b/setup/doctype/global_defaults/global_defaults.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-05-02 17:53:24", + "creation": "2013-07-16 18:18:01", "docstatus": 0, - "modified": "2013-05-22 15:57:26", + "modified": "2013-07-16 18:23:52", "modified_by": "Administrator", "owner": "Administrator" }, @@ -27,8 +27,6 @@ "permlevel": 0 }, { - "amend": 0, - "cancel": 0, "create": 1, "doctype": "DocPerm", "name": "__common__", @@ -439,6 +437,12 @@ "label": "Disable Rounded Total", "read_only": 0 }, + { + "doctype": "DocField", + "fieldname": "maintain_same_sales_rate", + "fieldtype": "Check", + "label": "Maintain same rate throughout sales cycle" + }, { "doctype": "DocField", "fieldname": "buying", @@ -526,6 +530,11 @@ "label": "SMS Sender Name", "read_only": 0 }, + { + "amend": 0, + "cancel": 0, + "doctype": "DocPerm" + }, { "doctype": "DocPerm" } From 6f61e2c4262549521d96650085b12f9d9614dfaf Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 16 Jul 2013 18:47:06 +0530 Subject: [PATCH 5/5] [fix] [minor] net_total on sales/purchase register --- accounts/report/purchase_register/purchase_register.py | 4 ++-- accounts/report/sales_register/sales_register.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/accounts/report/purchase_register/purchase_register.py b/accounts/report/purchase_register/purchase_register.py index 09705413a6..aa55a3b076 100644 --- a/accounts/report/purchase_register/purchase_register.py +++ b/accounts/report/purchase_register/purchase_register.py @@ -54,7 +54,7 @@ def execute(filters=None): row.append(expense_amount) # net total - row.append(net_total) + row.append(net_total or inv.net_total) # tax account total_tax = 0 @@ -121,7 +121,7 @@ def get_conditions(filters): def get_invoices(filters): conditions = get_conditions(filters) return webnotes.conn.sql("""select name, posting_date, credit_to, supplier, supplier_name, - bill_no, bill_date, remarks, grand_total, outstanding_amount + bill_no, bill_date, remarks, net_total, grand_total, outstanding_amount from `tabPurchase Invoice` where docstatus = 1 %s order by posting_date desc, name desc""" % conditions, filters, as_dict=1) diff --git a/accounts/report/sales_register/sales_register.py b/accounts/report/sales_register/sales_register.py index 91ad1c282f..653b5e65a0 100644 --- a/accounts/report/sales_register/sales_register.py +++ b/accounts/report/sales_register/sales_register.py @@ -54,7 +54,7 @@ def execute(filters=None): row.append(income_amount) # net total - row.append(net_total) + row.append(net_total or inv.net_total) # tax account total_tax = 0 @@ -120,7 +120,7 @@ def get_conditions(filters): def get_invoices(filters): conditions = get_conditions(filters) return webnotes.conn.sql("""select name, posting_date, debit_to, project_name, customer, - customer_name, remarks, grand_total, rounded_total, outstanding_amount + customer_name, remarks, net_total, grand_total, rounded_total, outstanding_amount from `tabSales Invoice` where docstatus = 1 %s order by posting_date desc, name desc""" % conditions, filters, as_dict=1)