Minor fixes
This commit is contained in:
parent
f6f8ec68ad
commit
8db8a91d2e
@ -75,8 +75,8 @@ frappe.ui.form.on("Stock Reconciliation", {
|
||||
frappe.model.set_value(cdt, cdn, "valuation_rate", r.message.rate);
|
||||
frappe.model.set_value(cdt, cdn, "current_qty", r.message.qty);
|
||||
frappe.model.set_value(cdt, cdn, "current_valuation_rate", r.message.rate);
|
||||
frappe.model.set_value(cdt, cdn, "current_amount", r.message.rate*r.message.qty);
|
||||
frappe.model.set_value(cdt, cdn, "amount", r.message.rate*r.message.qty);
|
||||
frappe.model.set_value(cdt, cdn, "current_amount", r.message.rate * r.message.qty);
|
||||
frappe.model.set_value(cdt, cdn, "amount", r.message.rate * r.message.qty);
|
||||
|
||||
}
|
||||
});
|
||||
@ -99,11 +99,11 @@ frappe.ui.form.on("Stock Reconciliation", {
|
||||
set_amount_quantity: function(doc, cdt, cdn) {
|
||||
var d = frappe.model.get_doc(cdt, cdn);
|
||||
if (d.qty & d.valuation_rate) {
|
||||
frappe.model.set_value(cdt, cdn, "amount", d.qty*d.valuation_rate);
|
||||
frappe.model.set_value(cdt, cdn, "quantity_difference", d.qty-d.current_qty);
|
||||
frappe.model.set_value(cdt, cdn, "amount_difference", d.amount-d.current_amount);
|
||||
}
|
||||
}
|
||||
frappe.model.set_value(cdt, cdn, "amount", flt(d.qty) * flt(d.valuation_rate));
|
||||
frappe.model.set_value(cdt, cdn, "quantity_difference", flt(d.qty) - flt(d.current_qty));
|
||||
frappe.model.set_value(cdt, cdn, "amount_difference", flt(d.amount) - flt(d.current_amount));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Stock Reconciliation Item", {
|
||||
|
@ -350,58 +350,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "new_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "New Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "existing_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Existing Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@ -441,7 +389,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 1,
|
||||
"menu_index": 0,
|
||||
"modified": "2016-09-24 10:35:42.284724",
|
||||
"modified": "2016-10-05 13:03:39.887647",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Reconciliation",
|
||||
@ -457,6 +405,7 @@
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
|
@ -27,6 +27,7 @@ class StockReconciliation(StockController):
|
||||
self.remove_items_with_no_change()
|
||||
self.validate_data()
|
||||
self.validate_expense_account()
|
||||
self.set_total_qty_and_amount()
|
||||
|
||||
def on_submit(self):
|
||||
self.update_stock_ledger()
|
||||
@ -54,8 +55,6 @@ class StockReconciliation(StockController):
|
||||
|
||||
item.current_qty = qty
|
||||
item.current_valuation_rate = rate
|
||||
self.new_amount = (flt(item.qty or qty) * flt(item.valuation_rate or rate))
|
||||
self.existing_amount = (flt(qty) * flt(rate))
|
||||
self.difference_amount += (flt(item.qty or qty) * flt(item.valuation_rate or rate) - (flt(qty) * flt(rate)))
|
||||
return True
|
||||
|
||||
@ -238,6 +237,13 @@ class StockReconciliation(StockController):
|
||||
elif not frappe.db.sql("""select name from `tabStock Ledger Entry` limit 1"""):
|
||||
if frappe.db.get_value("Account", self.expense_account, "report_type") == "Profit and Loss":
|
||||
frappe.throw(_("Difference Account must be a Asset/Liability type account, since this Stock Reconciliation is an Opening Entry"), OpeningEntryAccountError)
|
||||
|
||||
def set_total_qty_and_amount(self):
|
||||
for d in self.get("items"):
|
||||
d.amount = flt(d.qty) * flt(d.valuation_rate)
|
||||
d.current_amount = flt(d.current_qty) * flt(d.current_valuation_rate)
|
||||
d.quantity_difference = flt(d.qty) - flt(d.current_qty)
|
||||
d.amount_difference = flt(d.amount) - flt(d.current_amount)
|
||||
|
||||
def get_items_for(self, warehouse):
|
||||
self.items = []
|
||||
|
Loading…
Reference in New Issue
Block a user