Landed cost voucher minor fixes

This commit is contained in:
Nabin Hait 2014-08-08 13:16:33 +05:30
parent f3e1181ad9
commit 2b776e8c3a
6 changed files with 51 additions and 41 deletions

View File

@ -32,8 +32,10 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"label": "Purchase Receipt", "label": "Purchase Receipt",
"no_copy": 1,
"options": "Purchase Receipt", "options": "Purchase Receipt",
"permlevel": 0, "permlevel": 0,
"print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{ {
@ -54,6 +56,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 0, "in_list_view": 0,
"label": "Rate", "label": "Rate",
"options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
@ -64,7 +67,7 @@
"label": "Amount", "label": "Amount",
"oldfieldname": "amount", "oldfieldname": "amount",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "currency", "options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"read_only": 1, "read_only": 1,
"reqd": 1 "reqd": 1
@ -74,19 +77,24 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Applicable Charges", "label": "Applicable Charges",
"options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "pr_item_row_id", "fieldname": "purchase_receipt_item",
"fieldtype": "Data", "fieldtype": "Data",
"label": "PR Item Row Id", "hidden": 1,
"permlevel": 0 "label": "Purchase Receipt Item",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"read_only": 1
} }
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2014-07-15 18:01:26.152422", "modified": "2014-08-08 13:11:29.438664",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Landed Cost Item", "name": "Landed Cost Item",

View File

@ -34,12 +34,13 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"in_list_view": 1, "in_list_view": 1,
"label": "Amount", "label": "Amount",
"options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
} }
], ],
"istable": 1, "istable": 1,
"modified": "2014-07-11 13:00:14.770284", "modified": "2014-08-08 13:12:02.594698",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Landed Cost Taxes and Charges", "name": "Landed Cost Taxes and Charges",

View File

@ -48,6 +48,7 @@
"fieldname": "total_taxes_and_charges", "fieldname": "total_taxes_and_charges",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Total Taxes and Charges", "label": "Total Taxes and Charges",
"options": "Company:company:default_currency",
"permlevel": 0, "permlevel": 0,
"read_only": 1, "read_only": 1,
"reqd": 1 "reqd": 1
@ -71,7 +72,7 @@
} }
], ],
"is_submittable": 1, "is_submittable": 1,
"modified": "2014-07-11 15:34:51.306164", "modified": "2014-08-08 13:11:55.764550",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Landed Cost Voucher", "name": "Landed Cost Voucher",

View File

@ -28,7 +28,7 @@ class LandedCostVoucher(Document):
item.rate = d.rate item.rate = d.rate
item.amount = d.amount item.amount = d.amount
item.purchase_receipt = pr.purchase_receipt item.purchase_receipt = pr.purchase_receipt
item.pr_item_row_id = d.name item.purchase_receipt_item = d.name
if self.get("landed_cost_taxes_and_charges"): if self.get("landed_cost_taxes_and_charges"):
self.set_applicable_charges_for_item() self.set_applicable_charges_for_item()

View File

@ -74,7 +74,7 @@ class PurchaseReceipt(BuyingController):
for d in self.get("purchase_receipt_details"): for d in self.get("purchase_receipt_details"):
lc_voucher_amount = frappe.db.sql("""select sum(ifnull(applicable_charges, 0)) lc_voucher_amount = frappe.db.sql("""select sum(ifnull(applicable_charges, 0))
from `tabLanded Cost Item` from `tabLanded Cost Item`
where docstatus = 1 and pr_item_row_id = %s""", d.name) where docstatus = 1 and purchase_receipt_item = %s""", d.name)
d.landed_cost_voucher_amount = lc_voucher_amount[0][0] if lc_voucher_amount else 0.0 d.landed_cost_voucher_amount = lc_voucher_amount[0][0] if lc_voucher_amount else 0.0
def validate_rejected_warehouse(self): def validate_rejected_warehouse(self):
@ -288,23 +288,23 @@ class PurchaseReceipt(BuyingController):
stock_rbnb = self.get_company_default("stock_received_but_not_billed") stock_rbnb = self.get_company_default("stock_received_but_not_billed")
expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation") expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
default_cost_center = self.get_company_default("cost_center")
gl_entries = [] gl_entries = []
warehouse_with_no_account = [] warehouse_with_no_account = []
negative_expense_to_be_booked = 0.0 negative_expense_to_be_booked = 0.0
stock_items = self.get_stock_items() stock_items = self.get_stock_items()
for d in self.get("purchase_receipt_details"): for d in self.get("purchase_receipt_details"):
if d.item_code in stock_items and flt(d.valuation_rate): if d.item_code in stock_items and flt(d.valuation_rate) and flt(d.qty):
if warehouse_account.get(d.warehouse) and flt(d.qty) and flt(d.valuation_rate): if warehouse_account.get(d.warehouse):
# warehouse account # warehouse account
gl_entries.append(self.get_gl_dict({ gl_entries.append(self.get_gl_dict({
"account": warehouse_account[d.warehouse], "account": warehouse_account[d.warehouse],
"against": stock_rbnb, "against": stock_rbnb,
"cost_center": d.cost_center, "cost_center": d.cost_center,
"remarks": self.get("remarks") or "Accounting Entry for Stock", "remarks": self.get("remarks") or _("Accounting Entry for Stock"),
"debit": flt(d.valuation_rate) * flt(d.qty) * flt(d.conversion_factor) "debit": flt(flt(d.valuation_rate) * flt(d.qty) * flt(d.conversion_factor),
self.precision("valuation_rate", d))
})) }))
# stock received but not billed # stock received but not billed
@ -312,7 +312,7 @@ class PurchaseReceipt(BuyingController):
"account": stock_rbnb, "account": stock_rbnb,
"against": warehouse_account[d.warehouse], "against": warehouse_account[d.warehouse],
"cost_center": d.cost_center, "cost_center": d.cost_center,
"remarks": self.get("remarks") or "Accounting Entry for Stock", "remarks": self.get("remarks") or _("Accounting Entry for Stock"),
"credit": flt(d.base_amount, self.precision("base_amount", d)) "credit": flt(d.base_amount, self.precision("base_amount", d))
})) }))
@ -324,7 +324,7 @@ class PurchaseReceipt(BuyingController):
"account": expenses_included_in_valuation, "account": expenses_included_in_valuation,
"against": warehouse_account[d.warehouse], "against": warehouse_account[d.warehouse],
"cost_center": d.cost_center, "cost_center": d.cost_center,
"remarks": self.get("remarks") or "Accounting Entry for Stock", "remarks": self.get("remarks") or _("Accounting Entry for Stock"),
"credit": flt(d.landed_cost_voucher_amount) "credit": flt(d.landed_cost_voucher_amount)
})) }))
@ -334,7 +334,7 @@ class PurchaseReceipt(BuyingController):
"account": warehouse_account[self.supplier_warehouse], "account": warehouse_account[self.supplier_warehouse],
"against": warehouse_account[d.warehouse], "against": warehouse_account[d.warehouse],
"cost_center": d.cost_center, "cost_center": d.cost_center,
"remarks": self.get("remarks") or "Accounting Entry for Stock", "remarks": self.get("remarks") or _("Accounting Entry for Stock"),
"credit": flt(d.rm_supp_cost) "credit": flt(d.rm_supp_cost)
})) }))
@ -382,7 +382,7 @@ class PurchaseReceipt(BuyingController):
"account": expenses_included_in_valuation, "account": expenses_included_in_valuation,
"cost_center": cost_center, "cost_center": cost_center,
"credit": applicable_amount, "credit": applicable_amount,
"remarks": self.remarks or "Accounting Entry for Stock", "remarks": self.remarks or _("Accounting Entry for Stock"),
"against": against_account "against": against_account
}) })
) )

View File

@ -555,7 +555,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2014-07-30 18:13:18.337564", "modified": "2014-08-08 13:15:06.362562",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Purchase Receipt Item", "name": "Purchase Receipt Item",