From 27a981677ec9e9b7b6664da023b87517ffe1648c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 10 Jun 2013 16:32:55 +0530 Subject: [PATCH] [buying] [cleanup] deprecated load_default_taxes and get_purchase_tax_details --- .../purchase_invoice/purchase_invoice.py | 8 ----- .../purchase_common/purchase_common.py | 33 ------------------- .../doctype/purchase_order/purchase_order.py | 8 +---- .../supplier_quotation/supplier_quotation.py | 6 ---- controllers/buying_controller.py | 2 +- .../purchase_receipt/purchase_receipt.py | 6 ---- 6 files changed, 2 insertions(+), 61 deletions(-) diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index 56940fcce9..56d6075f5b 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -154,14 +154,6 @@ class DocType(BuyingController): def get_rate(self,arg): return get_obj('Purchase Common').get_rate(arg,self) - def load_default_taxes(self): - self.doclist = get_obj('Purchase Common').load_default_taxes(self) - - - def get_purchase_tax_details(self): - self.doclist = get_obj('Purchase Common').get_purchase_tax_details(self) - - def get_rate1(self,acc): rate = sql("select tax_rate from `tabAccount` where name='%s'"%(acc)) ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 } diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py index 0ceac1d09f..6d2baf6c14 100644 --- a/buying/doctype/purchase_common/purchase_common.py +++ b/buying/doctype/purchase_common/purchase_common.py @@ -387,39 +387,6 @@ class DocType(BuyingController): msgprint("'%s' Not Within The Fiscal Year"%(dn)) raise Exception - def load_default_taxes(self, obj): - return self.get_purchase_tax_details(obj, 1) - - def get_purchase_tax_details(self,obj, default = 0): - obj.doclist = self.doc.clear_table(obj.doclist,'purchase_tax_details') - - if default: add_cond = " and ifnull(t2.is_default,0) = 1" - else: add_cond = " and t1.parent = '"+cstr(obj.doc.purchase_other_charges)+"'" - - other_charge = sql(""" - select t1.* - from `tabPurchase Taxes and Charges` t1, `tabPurchase Taxes and Charges Master` t2 - where t1.parent = t2.name %s - order by t1.idx - """% add_cond, as_dict = 1) - - idx = 0 - for other in other_charge: - d = addchild(obj.doc, 'purchase_tax_details', 'Purchase Taxes and Charges', - obj.doclist) - d.category = other['category'] - d.add_deduct_tax = other['add_deduct_tax'] - d.charge_type = other['charge_type'] - d.row_id = other['row_id'] - d.description = other['description'] - d.account_head = other['account_head'] - d.rate = flt(other['rate']) - d.tax_amount = flt(other['tax_amount']) - d.cost_center = other["cost_center"] - d.idx = idx - idx += 1 - return obj.doclist - def get_rate(self, arg, obj): arg = eval(arg) rate = sql("select account_type, tax_rate from `tabAccount` where name = '%s'" %(arg['account_head']), as_dict=1) diff --git a/buying/doctype/purchase_order/purchase_order.py b/buying/doctype/purchase_order/purchase_order.py index d9569711c9..908df67403 100644 --- a/buying/doctype/purchase_order/purchase_order.py +++ b/buying/doctype/purchase_order/purchase_order.py @@ -224,10 +224,4 @@ class DocType(BuyingController): pass def get_rate(self,arg): - return get_obj('Purchase Common').get_rate(arg,self) - - def load_default_taxes(self): - self.doclist = get_obj('Purchase Common').load_default_taxes(self) - - def get_purchase_tax_details(self): - self.doclist = get_obj('Purchase Common').get_purchase_tax_details(self) + return get_obj('Purchase Common').get_rate(arg,self) \ No newline at end of file diff --git a/buying/doctype/supplier_quotation/supplier_quotation.py b/buying/doctype/supplier_quotation/supplier_quotation.py index 0982fd6d9f..421ecd0d44 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/buying/doctype/supplier_quotation/supplier_quotation.py @@ -63,12 +63,6 @@ class DocType(BuyingController): d.purchase_ref_rate = d.discount_rate = d.purchase_rate = 0.0 d.import_ref_rate = d.import_rate = 0.0 - def load_default_taxes(self): - self.doclist = get_obj('Purchase Common').load_default_taxes(self) - - def get_purchase_tax_details(self): - self.doclist = get_obj('Purchase Common').get_purchase_tax_details(self) - def validate_fiscal_year(self): get_obj(dt = 'Purchase Common').validate_fiscal_year( \ self.doc.fiscal_year, self.doc.transaction_date, 'Quotation Date') diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index f1cfc10a98..36ce28541b 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -54,7 +54,7 @@ class BuyingController(StockController): def get_purchase_tax_details(self): self.doclist = self.doc.clear_table(self.doclist, "purchase_tax_details") - self.set_taxes() + self.set_taxes("Purchase Taxes and Charges", "purchase_tax_details", "purchase_other_charges") def validate_warehouse_belongs_to_company(self): for warehouse, company in webnotes.conn.get_values("Warehouse", diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py index f47bdee8f7..83322c18a5 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/stock/doctype/purchase_receipt/purchase_receipt.py @@ -313,12 +313,6 @@ class DocType(BuyingController): def get_rate(self,arg): return get_obj('Purchase Common').get_rate(arg,self) - def load_default_taxes(self): - self.doclist = get_obj('Purchase Common').load_default_taxes(self) - - def get_purchase_tax_details(self): - self.doclist = get_obj('Purchase Common').get_purchase_tax_details(self) - def make_gl_entries(self): if not cint(webnotes.defaults.get_global_default("auto_inventory_accounting")): return