Table Field Renaming: code replace, JV and budget distribution renamed

This commit is contained in:
Nabin Hait
2014-12-25 16:01:55 +05:30
parent d8f4984d71
commit e7d153624f
222 changed files with 1523 additions and 1483 deletions

View File

@@ -145,8 +145,8 @@ class AccountsController(TransactionBase):
get_taxes_and_charges(tax_master_doctype, self.get(tax_master_field), tax_parentfield))
def set_other_charges(self):
self.set("other_charges", [])
self.set_taxes("other_charges", "taxes_and_charges")
self.set("taxes", [])
self.set_taxes("taxes", "taxes_and_charges")
def calculate_taxes_and_totals(self):
self.discount_amount_applied = False
@@ -394,7 +394,7 @@ class AccountsController(TransactionBase):
select
t1.name as jv_no, t1.remark, t2.{0} as amount, t2.name as jv_detail_no, `against_{1}` as against_order
from
`tabJournal Voucher` t1, `tabJournal Voucher Detail` t2
`tabJournal Voucher` t1, `tabJournal Entry Account` t2
where
t1.name = t2.parent and t2.account = %s
and t2.party_type=%s and t2.party=%s
@@ -426,7 +426,7 @@ class AccountsController(TransactionBase):
account = self.get("debit_to" if self.doctype=="Sales Invoice" else "credit_to")
jv_against_order = frappe.db.sql("""select parent, %s as against_order
from `tabJournal Voucher Detail`
from `tabJournal Entry Account`
where docstatus=1 and account=%s and ifnull(is_advance, 'No') = 'Yes'
and ifnull(against_sales_order, '') in (%s)
group by parent, against_sales_order""" %
@@ -501,7 +501,7 @@ class AccountsController(TransactionBase):
select
sum(ifnull({dr_or_cr}, 0))
from
`tabJournal Voucher Detail`
`tabJournal Entry Account`
where
{against_field} = %s and docstatus = 1 and is_advance = "Yes" """.format(dr_or_cr=dr_or_cr, \
against_field=against_field), self.name)

View File

@@ -17,7 +17,7 @@ class BuyingController(StockController):
if hasattr(self, "fname"):
self.table_print_templates = {
self.fname: "templates/print_formats/includes/item_grid.html",
"other_charges": "templates/print_formats/includes/taxes.html",
"taxes": "templates/print_formats/includes/taxes.html",
}
def get_feed(self):
@@ -46,7 +46,7 @@ class BuyingController(StockController):
self.set_missing_item_details()
if self.get("__islocal"):
self.set_taxes("other_charges", "taxes_and_charges")
self.set_taxes("taxes", "taxes_and_charges")
def set_supplier_from_item_default(self):
if self.meta.get_field("supplier") and not self.supplier:
@@ -66,8 +66,8 @@ class BuyingController(StockController):
validate_warehouse_company(w, self.company)
def validate_stock_or_nonstock_items(self):
if self.meta.get_field("other_charges") and not self.get_stock_items():
tax_for_valuation = [d.account_head for d in self.get("other_charges")
if self.meta.get_field("taxes") and not self.get_stock_items():
tax_for_valuation = [d.account_head for d in self.get("taxes")
if d.category in ["Valuation", "Valuation and Total"]]
if tax_for_valuation:
frappe.throw(_("Tax Category can not be 'Valuation' or 'Valuation and Total' as all items are non-stock items"))
@@ -82,9 +82,9 @@ class BuyingController(StockController):
self.currency)
def calculate_taxes_and_totals(self):
self.other_fname = "other_charges"
self.other_fname = "taxes"
super(BuyingController, self).calculate_taxes_and_totals()
self.calculate_total_advance("Purchase Invoice", "advance_allocation_details")
self.calculate_total_advance("Purchase Invoice", "advances")
def calculate_item_values(self):
for item in self.item_doclist:
@@ -175,7 +175,7 @@ class BuyingController(StockController):
last_stock_item_idx = d.idx
total_valuation_amount = sum([flt(d.tax_amount) for d in
self.get("other_charges")
self.get("taxes")
if d.category in ["Valuation", "Valuation and Total"]])

View File

@@ -15,7 +15,7 @@ class SellingController(StockController):
if hasattr(self, "fname"):
self.table_print_templates = {
self.fname: "templates/print_formats/includes/item_grid.html",
"other_charges": "templates/print_formats/includes/taxes.html",
"taxes": "templates/print_formats/includes/taxes.html",
}
def get_feed(self):
@@ -44,7 +44,7 @@ class SellingController(StockController):
self.set_missing_lead_customer_details()
self.set_price_list_and_item_details()
if self.get("__islocal"):
self.set_taxes("other_charges", "taxes_and_charges")
self.set_taxes("taxes", "taxes_and_charges")
def set_missing_lead_customer_details(self):
if getattr(self, "customer", None):
@@ -73,7 +73,7 @@ class SellingController(StockController):
# shipping rule calculation based on item's net weight
shipping_amount = 0.0
for condition in shipping_rule.get("shipping_rule_conditions"):
for condition in shipping_rule.get("conditions"):
if not condition.to_value or (flt(condition.from_value) <= value <= flt(condition.to_value)):
shipping_amount = condition.shipping_amount
break
@@ -85,28 +85,28 @@ class SellingController(StockController):
"cost_center": shipping_rule.cost_center
}
existing_shipping_charge = self.get("other_charges", filters=shipping_charge)
existing_shipping_charge = self.get("taxes", filters=shipping_charge)
if existing_shipping_charge:
# take the last record found
existing_shipping_charge[-1].rate = shipping_amount
else:
shipping_charge["rate"] = shipping_amount
shipping_charge["description"] = shipping_rule.label
self.append("other_charges", shipping_charge)
self.append("taxes", shipping_charge)
self.calculate_taxes_and_totals()
def remove_shipping_charge(self):
if self.shipping_rule:
shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule)
existing_shipping_charge = self.get("other_charges", {
existing_shipping_charge = self.get("taxes", {
"doctype": "Sales Taxes and Charges",
"charge_type": "Actual",
"account_head": shipping_rule.account,
"cost_center": shipping_rule.cost_center
})
if existing_shipping_charge:
self.get("other_charges").remove(existing_shipping_charge[-1])
self.get("taxes").remove(existing_shipping_charge[-1])
self.calculate_taxes_and_totals()
def set_total_in_words(self):
@@ -124,11 +124,11 @@ class SellingController(StockController):
self.grand_total_export or self.rounded_total_export, self.currency)
def calculate_taxes_and_totals(self):
self.other_fname = "other_charges"
self.other_fname = "taxes"
super(SellingController, self).calculate_taxes_and_totals()
self.calculate_total_advance("Sales Invoice", "advance_adjustment_details")
self.calculate_total_advance("Sales Invoice", "advances")
self.calculate_commission()
self.calculate_contribution()
@@ -343,7 +343,7 @@ class SellingController(StockController):
reserved_qty_for_main_item = -flt(d.qty)
if self.has_sales_bom(d.item_code):
for p in self.get("packing_details"):
for p in self.get("packed_items"):
if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
# the packing details table's qty is already multiplied with parent's qty
il.append(frappe._dict({