This commit is contained in:
Rushabh Mehta 2013-01-23 19:44:35 +05:30
commit 9c77a25cd3
28 changed files with 93 additions and 319 deletions

View File

@ -35,16 +35,23 @@ cur_frm.cscript.refresh = function(doc) {
cur_frm.fields_dict.voucher_no.get_query = function(doc) { cur_frm.fields_dict.voucher_no.get_query = function(doc) {
if (!doc.account) msgprint("Please select Account first"); if (!doc.account) msgprint("Please select Account first");
else { else {
return repl("select gle.voucher_no, gle.posting_date \ return repl("select gle.voucher_no, gle.posting_date, gle.%(account_type)s \
from `tabGL Entry` gle where gle.account = '%(acc)s' \ from `tabGL Entry` gle \
where gle.account = '%(acc)s' \
and gle.voucher_type = '%(dt)s' \ and gle.voucher_type = '%(dt)s' \
and gle.voucher_no LIKE '%s' \ and gle.voucher_no like '%s' \
and ifnull(gle.is_cancelled, 'No') = 'No' \ and ifnull(gle.is_cancelled, 'No') = 'No' \
and (select sum(debit) - sum(credit) from `tabGL Entry` \ and (ifnull(gle.against_voucher, '') = '' \
where against_voucher_type = '%(dt)s' and against_voucher = gle.voucher_no \ or ifnull(gle.against_voucher, '') = gle.voucher_no ) \
and ifnull(is_cancelled, 'No') = 'No') != 0 \ and ifnull(gle.%(account_type)s, 0) > 0 \
ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50 \ and (select ifnull(abs(sum(debit) - sum(credit)), 0) from `tabGL Entry` \
", {dt:doc.voucher_type, acc:doc.account}); where against_voucher_type = '%(dt)s' \
and against_voucher = gle.voucher_no \
and voucher_no != gle.voucher_no \
and ifnull(is_cancelled, 'No') = 'No') != \
abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) \
ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50",
{dt:doc.voucher_type, acc:doc.account, account_type: doc.account_type});
} }
} }
@ -52,3 +59,12 @@ cur_frm.cscript.voucher_no =function(doc, cdt, cdn) {
get_server_fields('get_voucher_details', '', '', doc, cdt, cdn, 1) get_server_fields('get_voucher_details', '', '', doc, cdt, cdn, 1)
} }
cur_frm.cscript.account = function(doc, cdt, cdn) {
wn.call({
doc: this.frm.doc,
method: "set_account_type",
callback: function(r) {
if(!r.exc) refresh_field("account_type");
}
});
}

View File

@ -27,32 +27,32 @@ class DocType:
def __init__(self, doc, doclist): def __init__(self, doc, doclist):
self.doc = doc self.doc = doc
self.doclist = doclist self.doclist = doclist
self.acc_type = self.doc.account and webnotes.conn.sql("""select debit_or_credit
from `tabAccount` where name = %s""", self.doc.account)[0][0].lower() or '' def set_account_type(self):
self.dt = { self.doc.account_type = self.doc.account and \
'Sales Invoice': 'Sales Invoice', webnotes.conn.get_value("Account", self.doc.account, "debit_or_credit").lower() or ""
'Purchase Invoice': 'Purchase Invoice',
'Journal Voucher': 'Journal Voucher'
}
def get_voucher_details(self): def get_voucher_details(self):
tot_amt = webnotes.conn.sql(""" total_amount = webnotes.conn.sql("""select %s from `tabGL Entry`
select sum(%s) from `tabGL Entry` where where voucher_type = %s and voucher_no = %s
voucher_type = %s and voucher_no = %s
and account = %s and ifnull(is_cancelled, 'No') = 'No'""" % and account = %s and ifnull(is_cancelled, 'No') = 'No'""" %
(self.acc_type, '%s', '%s', '%s'), (self.doc.account_type, '%s', '%s', '%s'),
(self.dt[self.doc.voucher_type], self.doc.voucher_no, self.doc.account)) (self.doc.voucher_type, self.doc.voucher_no, self.doc.account))
outstanding = webnotes.conn.sql(""" total_amount = total_amount and flt(total_amount[0][0]) or 0
reconciled_payment = webnotes.conn.sql("""
select sum(%s) - sum(%s) from `tabGL Entry` where select sum(%s) - sum(%s) from `tabGL Entry` where
against_voucher = %s and voucher_no != %s against_voucher = %s and voucher_no != %s
and account = %s and ifnull(is_cancelled, 'No') = 'No'""" % and account = %s and ifnull(is_cancelled, 'No') = 'No'""" %
((self.acc_type == 'debit' and 'credit' or 'debit'), self.acc_type, '%s', '%s', '%s'), ((self.doc.account_type == 'debit' and 'credit' or 'debit'), self.doc.account_type,
(self.doc.voucher_no, self.doc.voucher_no, self.doc.account)) '%s', '%s', '%s'), (self.doc.voucher_no, self.doc.voucher_no, self.doc.account))
reconciled_payment = reconciled_payment and flt(reconciled_payment[0][0]) or 0
ret = { ret = {
'total_amount': flt(tot_amt[0][0]) or 0, 'total_amount': total_amount,
'pending_amt_to_reconcile': flt(tot_amt[0][0]) - flt(outstanding[0][0]) or 0 'pending_amt_to_reconcile': total_amount - reconciled_payment
} }
return ret return ret
@ -69,7 +69,7 @@ class DocType:
def get_gl_entries(self): def get_gl_entries(self):
self.validate_mandatory() self.validate_mandatory()
dc = self.acc_type == 'debit' and 'credit' or 'debit' dc = self.doc.account_type == 'debit' and 'credit' or 'debit'
cond = self.doc.from_date and " and t1.posting_date >= '" + self.doc.from_date + "'" or "" cond = self.doc.from_date and " and t1.posting_date >= '" + self.doc.from_date + "'" or ""
cond += self.doc.to_date and " and t1.posting_date <= '" + self.doc.to_date + "'"or "" cond += self.doc.to_date and " and t1.posting_date <= '" + self.doc.to_date + "'"or ""
@ -97,7 +97,7 @@ class DocType:
'Payment to Invoice Matching Tool Detail', self.doclist) 'Payment to Invoice Matching Tool Detail', self.doclist)
ch.voucher_no = d.get('voucher_no') ch.voucher_no = d.get('voucher_no')
ch.posting_date = d.get('posting_date') ch.posting_date = d.get('posting_date')
ch.amt_due = self.acc_type == 'debit' and flt(d.get('amt_due')) \ ch.amt_due = self.doc.account_type == 'debit' and flt(d.get('amt_due')) \
or -1*flt(d.get('amt_due')) or -1*flt(d.get('amt_due'))
ch.total_amt = flt(d.get('total_amt')) ch.total_amt = flt(d.get('total_amt'))
ch.against_account = d.get('against_account') ch.against_account = d.get('against_account')
@ -116,7 +116,7 @@ class DocType:
3. submit payment voucher 3. submit payment voucher
""" """
if not self.doc.voucher_no or not webnotes.conn.sql("""select name from `tab%s` if not self.doc.voucher_no or not webnotes.conn.sql("""select name from `tab%s`
where name = %s""" % (self.dt[self.doc.voucher_type], '%s'), self.doc.voucher_no): where name = %s""" % (self.doc.voucher_type, '%s'), self.doc.voucher_no):
msgprint("Please select valid Voucher No to proceed", raise_exception=1) msgprint("Please select valid Voucher No to proceed", raise_exception=1)
lst = [] lst = []
@ -125,11 +125,11 @@ class DocType:
args = { args = {
'voucher_no' : d.voucher_no, 'voucher_no' : d.voucher_no,
'voucher_detail_no' : d.voucher_detail_no, 'voucher_detail_no' : d.voucher_detail_no,
'against_voucher_type' : self.dt[self.doc.voucher_type], 'against_voucher_type' : self.doc.voucher_type,
'against_voucher' : self.doc.voucher_no, 'against_voucher' : self.doc.voucher_no,
'account' : self.doc.account, 'account' : self.doc.account,
'is_advance' : 'No', 'is_advance' : 'No',
'dr_or_cr' : self.acc_type=='debit' and 'credit' or 'debit', 'dr_or_cr' : self.doc.account_type=='debit' and 'credit' or 'debit',
'unadjusted_amt' : flt(d.amt_due), 'unadjusted_amt' : flt(d.amt_due),
'allocated_amt' : flt(d.amt_to_be_reconciled) 'allocated_amt' : flt(d.amt_to_be_reconciled)
} }

View File

@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-21 18:19:17", "creation": "2013-01-23 15:27:14",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-23 17:11:27", "modified": "2013-01-23 17:11:27",
"modified_by": "Administrator", "modified_by": "Administrator",
@ -56,6 +56,13 @@
"label": "Company", "label": "Company",
"options": "Company", "options": "Company",
"print_hide": 1 "print_hide": 1
{
"doctype": "DocField",
"fieldname": "account_type",
"fieldtype": "Data",
"hidden": 1,
"label": "Account Type",
"read_only": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",

View File

@ -0,0 +1,4 @@
def execute():
import webnotes
webnotes.delete_doc("DocType", "Landed Cost Master")
webnotes.delete_doc("DocType", "Landed Cost Master Detail")

View File

@ -0,0 +1,13 @@
def execute():
import webnotes
for dt in webnotes.conn.sql("""select name, issingle from tabDocType"""):
if dt[1]:
webnotes.conn.sql("""update tabDocPerm set report = 0 where parent = %s""", dt[0])
doctype = webnotes.model_wrapper("DocType", dt[0])
for pl in [1, 2, 3]:
if not doctype.doclist.get({"doctype": "DocField", "permlevel": pl}):
if doctype.doclist.get({"doctype":"DocPerm", "permlevel":pl}):
webnotes.conn.sql("""delete from `tabDocPerm`
where parent = %s and permlevel = %s""", (dt[0], pl))

View File

@ -156,4 +156,6 @@ patch_list = [
"execute:webnotes.reload_doc('accounts','Print Format','Payment Receipt Voucher')", "execute:webnotes.reload_doc('accounts','Print Format','Payment Receipt Voucher')",
"patches.january_2013.update_fraction_for_usd", "patches.january_2013.update_fraction_for_usd",
"patches.january_2013.enable_currencies", "patches.january_2013.enable_currencies",
"patches.january_2013.remove_unwanted_permission",
"patches.january_2013.remove_landed_cost_master",
] ]

View File

@ -16,7 +16,7 @@ def project_perms():
def stock_perms(): def stock_perms():
webnotes.conn.sql("""delete from `tabDocPerm` webnotes.conn.sql("""delete from `tabDocPerm`
where parent in ('Landed Cost Master', 'Landed Cost Wizard', where parent in ('Landed Cost Wizard',
'Sales and Purchase Return Tool') and role='All' and permlevel=0""") 'Sales and Purchase Return Tool') and role='All' and permlevel=0""")
def account_perms(): def account_perms():

View File

@ -53,6 +53,7 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({
formatter: this.check_formatter}, formatter: this.check_formatter},
{id: "name", name: "Item", field: "name", width: 300, {id: "name", name: "Item", field: "name", width: 300,
formatter: this.tree_formatter}, formatter: this.tree_formatter},
{id: "stock_uom", name: "UOM", field: "stock_uom", width: 100},
{id: "brand", name: "Brand", field: "brand", width: 100}, {id: "brand", name: "Brand", field: "brand", width: 100},
{id: "opening", name: "Opening", field: "opening", hidden: true, {id: "opening", name: "Opening", field: "opening", hidden: true,
formatter: this.currency_formatter} formatter: this.currency_formatter}

View File

@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-10 16:34:22", "creation": "2013-01-22 16:50:36",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-23 16:51:54", "modified": "2013-01-23 16:51:54",
"modified_by": "Administrator", "modified_by": "Administrator",

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,30 +0,0 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}
cur_frm.fields_dict.landed_cost.grid.get_field('account_head').get_query = function(doc, cdt, cdn) {
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.name LIKE "%s"';
}

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,86 +0,0 @@
[
{
"creation": "2013-01-10 16:34:27",
"docstatus": 0,
"modified": "2013-01-22 14:56:03",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"autoname": "field:title",
"doctype": "DocType",
"document_type": "Master",
"module": "Stock",
"name": "__common__"
},
{
"doctype": "DocField",
"name": "__common__",
"parent": "Landed Cost Master",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Landed Cost Master",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"report": 1,
"submit": 0,
"write": 1
},
{
"doctype": "DocType",
"name": "Landed Cost Master"
},
{
"doctype": "DocField",
"fieldname": "trash_reason",
"fieldtype": "Small Text",
"label": "Trash Reason",
"oldfieldname": "trash_reason",
"oldfieldtype": "Small Text",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "title",
"fieldtype": "Data",
"label": "Title",
"oldfieldname": "title",
"oldfieldtype": "Data"
},
{
"doctype": "DocField",
"fieldname": "landed_cost_details",
"fieldtype": "Section Break",
"label": "Landed Cost Items",
"oldfieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "landed_cost",
"fieldtype": "Table",
"label": "Landed Cost",
"oldfieldname": "landed_cost",
"oldfieldtype": "Table",
"options": "Landed Cost Master Detail"
},
{
"doctype": "DocPerm",
"role": "Purchase Manager"
},
{
"doctype": "DocPerm",
"role": "System Manager"
},
{
"doctype": "DocPerm",
"role": "Purchase User"
}
]

View File

@ -1,8 +0,0 @@
[
"Trash Reason",
"Title",
"Landed Cost Master",
"Landed Cost",
"Landed Cost Items",
"Stock"
]

View File

@ -1,8 +0,0 @@
{
"Landed Cost": "\u0906\u092f\u093e\u0924\u093f\u0924 \u092e\u093e\u0932 \u0915\u0940 \u0932\u093e\u0917\u0924",
"Landed Cost Items": "\u0906\u092f\u093e\u0924\u093f\u0924 \u092e\u093e\u0932 \u0915\u0940 \u0932\u093e\u0917\u0924 \u0906\u0907\u091f\u092e",
"Landed Cost Master": "\u0906\u092f\u093e\u0924\u093f\u0924 \u092e\u093e\u0932 \u0915\u0940 \u0932\u093e\u0917\u0924 \u092e\u093e\u0938\u094d\u091f\u0930",
"Stock": "\u0938\u094d\u091f\u0949\u0915",
"Title": "\u0936\u0940\u0930\u094d\u0937\u0915",
"Trash Reason": "\u091f\u094d\u0930\u0948\u0936 \u0915\u093e\u0930\u0923"
}

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,22 +0,0 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,48 +0,0 @@
[
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-05-03 11:00:55",
"modified_by": "Administrator",
"modified": "2012-05-04 13:02:35"
},
{
"section_style": "Simple",
"istable": 1,
"name": "__common__",
"colour": "White:FFF",
"module": "Stock",
"doctype": "DocType",
"version": 1,
"server_code_error": " "
},
{
"name": "__common__",
"parent": "Landed Cost Master Detail",
"oldfieldtype": "Data",
"doctype": "DocField",
"parenttype": "DocType",
"permlevel": 0,
"parentfield": "fields"
},
{
"name": "Landed Cost Master Detail",
"doctype": "DocType"
},
{
"doctype": "DocField",
"label": "Account Head",
"oldfieldname": "account_head",
"fieldname": "account_head",
"fieldtype": "Link",
"options": "Account"
},
{
"doctype": "DocField",
"label": "Description",
"oldfieldname": "description",
"width": "300px",
"fieldname": "description",
"fieldtype": "Data"
}
]

View File

@ -1,6 +0,0 @@
[
"Description",
"Landed Cost Master Detail",
"Account Head",
"Stock"
]

View File

@ -1,6 +0,0 @@
{
"Account Head": "\u0932\u0947\u0916\u093e\u0936\u0940\u0930\u094d\u0937",
"Description": "\u0935\u093f\u0935\u0930\u0923",
"Landed Cost Master Detail": "\u0909\u0924\u0930\u093e \u0932\u093e\u0917\u0924 \u092e\u093e\u0938\u094d\u091f\u0930 \u0935\u093f\u0938\u094d\u0924\u093e\u0930",
"Stock": "\u0938\u094d\u091f\u0949\u0915"
}

View File

@ -56,19 +56,6 @@ class DocType:
ch.purchase_receipt = i and i['name'] or '' ch.purchase_receipt = i and i['name'] or ''
ch.save() ch.save()
def get_landed_cost_master_details(self):
""" pull details from landed cost master"""
self.doclist = self.doc.clear_table(self.doclist, 'landed_cost_details')
idx = 0
landed_cost = sql("select account_head, description from `tabLanded Cost Master Detail` where parent=%s", (self.doc.landed_cost), as_dict = 1)
for cost in landed_cost:
lct = addchild(self.doc, 'landed_cost_details', 'Landed Cost Item',
self.doclist)
lct.account_head = cost['account_head']
lct.description = cost['description']
def get_selected_pr(self): def get_selected_pr(self):
""" Get selected purchase receipt no """ """ Get selected purchase receipt no """
self.selected_pr = [d.purchase_receipt for d in getlist(self.doclist, 'lc_pr_details') if d.select_pr] self.selected_pr = [d.purchase_receipt for d in getlist(self.doclist, 'lc_pr_details') if d.select_pr]
@ -199,9 +186,6 @@ class DocType:
ocd[oc].total_tax_amount = flt(prev_total) ocd[oc].total_tax_amount = flt(prev_total)
ocd[oc].tax_amount += flt(tax_amount) ocd[oc].tax_amount += flt(tax_amount)
total_amount = flt(ocd[oc].tax_amount)
total_tax_amount = flt(ocd[oc].total_tax_amount) + (add_ded * flt(total_amount))
if ocd[oc].category != "Valuation": if ocd[oc].category != "Valuation":
prev_total += add_ded * flt(ocd[oc].total_amount) prev_total += add_ded * flt(ocd[oc].total_amount)
total += add_ded * flt(ocd[oc].tax_amount) total += add_ded * flt(ocd[oc].tax_amount)

View File

@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-10 16:34:28", "creation": "2013-01-22 16:50:39",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-22 16:54:49", "modified": "2013-01-22 16:54:49",
"modified_by": "Administrator", "modified_by": "Administrator",
@ -29,7 +29,7 @@
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"report": 1, "report": 0,
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
@ -92,20 +92,6 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"options": "Simple" "options": "Simple"
}, },
{
"doctype": "DocField",
"fieldname": "landed_cost",
"fieldtype": "Link",
"label": "Select Landed Cost Items Master",
"options": "Landed Cost Master"
},
{
"doctype": "DocField",
"fieldname": "get_details",
"fieldtype": "Button",
"label": "Get Details",
"options": "get_landed_cost_master_details"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "landed_cost_details", "fieldname": "landed_cost_details",

View File

@ -141,11 +141,18 @@ class DocType(DocListController):
"posting_time": self.doc.posting_time "posting_time": self.doc.posting_time
}) })
# check valuation rate mandatory
if row.qty != "" and not row.valuation_rate and \
flt(previous_sle.get("qty_after_transaction")) <= 0:
webnotes.msgprint(_("As existing qty for item: ") + row.item_code +
_(" is less than equals to zero in the system, \
valuation rate is mandatory for this item"), raise_exception=1)
change_in_qty = row.qty != "" and \ change_in_qty = row.qty != "" and \
(flt(row.qty) - flt(previous_sle.get("qty_after_transaction"))) (flt(row.qty) - flt(previous_sle.get("qty_after_transaction")))
change_in_rate = row.valuation_rate != "" and \ change_in_rate = row.valuation_rate != "" and \
(flt(row.valuation_rate) != flt(previous_sle.get("valuation_rate"))) (flt(row.valuation_rate) - flt(previous_sle.get("valuation_rate")))
if get_valuation_method(row.item_code) == "Moving Average": if get_valuation_method(row.item_code) == "Moving Average":
self.sle_for_moving_avg(row, previous_sle, change_in_qty, change_in_rate) self.sle_for_moving_avg(row, previous_sle, change_in_qty, change_in_rate)
@ -162,7 +169,6 @@ class DocType(DocListController):
else: else:
if valuation_rate == "": if valuation_rate == "":
valuation_rate = previous_valuation_rate valuation_rate = previous_valuation_rate
return (qty * valuation_rate - previous_qty * previous_valuation_rate) \ return (qty * valuation_rate - previous_qty * previous_valuation_rate) \
/ flt(qty - previous_qty) / flt(qty - previous_qty)
@ -175,7 +181,7 @@ class DocType(DocListController):
self.insert_entries({"actual_qty": change_in_qty, self.insert_entries({"actual_qty": change_in_qty,
"incoming_rate": incoming_rate}, row) "incoming_rate": incoming_rate}, row)
elif change_in_rate and flt(previous_sle.get("qty_after_transaction")) >= 0: elif change_in_rate and flt(previous_sle.get("qty_after_transaction")) > 0:
# if no change in qty, but change in rate # if no change in qty, but change in rate
# and positive actual stock before this reconciliation # and positive actual stock before this reconciliation
incoming_rate = _get_incoming_rate( incoming_rate = _get_incoming_rate(
@ -241,7 +247,6 @@ class DocType(DocListController):
"is_cancelled": "No", "is_cancelled": "No",
} }
args.update(opts) args.update(opts)
# create stock ledger entry # create stock ledger entry
sle_wrapper = webnotes.model_wrapper([args]) sle_wrapper = webnotes.model_wrapper([args])
sle_wrapper.ignore_permissions = 1 sle_wrapper.ignore_permissions = 1

View File

@ -21,7 +21,6 @@ import webnotes
from webnotes.tests import insert_test_data from webnotes.tests import insert_test_data
from webnotes.utils import flt from webnotes.utils import flt
import json import json
from pprint import pprint
company = webnotes.conn.get_default("company") company = webnotes.conn.get_default("company")

View File

@ -48,13 +48,14 @@ erpnext.StockAgeing = erpnext.StockGridReport.extend({
open_btn: true, open_btn: true,
doctype: '"Item"' doctype: '"Item"'
}}, }},
{id: "brand", name: "Brand", field: "brand", width: 100},
{id: "average_age", name: "Average Age", field: "average_age", {id: "average_age", name: "Average Age", field: "average_age",
formatter: this.currency_formatter}, formatter: this.currency_formatter},
{id: "earliest", name: "Earliest", field: "earliest", {id: "earliest", name: "Earliest", field: "earliest",
formatter: this.currency_formatter}, formatter: this.currency_formatter},
{id: "latest", name: "Latest", field: "latest", {id: "latest", name: "Latest", field: "latest",
formatter: this.currency_formatter}, formatter: this.currency_formatter},
{id: "stock_uom", name: "UOM", field: "stock_uom", width: 100},
{id: "brand", name: "Brand", field: "brand", width: 100},
{id: "item_name", name: "Item Name", field: "item_name", {id: "item_name", name: "Item Name", field: "item_name",
width: 100, formatter: this.text_formatter}, width: 100, formatter: this.text_formatter},
{id: "description", name: "Description", field: "description", {id: "description", name: "Description", field: "description",

View File

@ -60,7 +60,7 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
formatter: this.currency_formatter}, formatter: this.currency_formatter},
{id: "closing_value", name: "Closing Value", field: "closing_value", width: 100, {id: "closing_value", name: "Closing Value", field: "closing_value", width: 100,
formatter: this.currency_formatter}, formatter: this.currency_formatter},
{id: "stock_uom", name: "UOM", field: "stock_uom", width: 100},
{id: "brand", name: "Brand", field: "brand", width: 100}, {id: "brand", name: "Brand", field: "brand", width: 100},
{id: "item_name", name: "Item Name", field: "item_name", width: 100}, {id: "item_name", name: "Item Name", field: "item_name", width: 100},
{id: "description", name: "Description", field: "description", width: 200, {id: "description", name: "Description", field: "description", width: 200,

View File

@ -78,11 +78,6 @@ wn.module_page["Stock"] = [
"label": wn._("Quality Inspection"), "label": wn._("Quality Inspection"),
description: wn._("Incoming quality inspection.") description: wn._("Incoming quality inspection.")
}, },
{
"doctype":"Landed Cost Master",
"label":"Landed Cost Master",
description: wn._("Transportatoin cost distribution template.")
},
{ {
"route":"Form/Landed Cost Wizard/Landed Cost Wizard", "route":"Form/Landed Cost Wizard/Landed Cost Wizard",
"label": wn._("Landed Cost Wizard"), "label": wn._("Landed Cost Wizard"),

View File

@ -64,7 +64,6 @@ def delete_masters():
'Letter Head':'', 'Letter Head':'',
'Leave Type':['Leave Without Pay', 'Privilege Leave', 'Casual Leave', 'PL', 'CL', 'LWP', 'Leave Type':['Leave Without Pay', 'Privilege Leave', 'Casual Leave', 'PL', 'CL', 'LWP',
'Compensatory Off', 'Sick Leave'], 'Compensatory Off', 'Sick Leave'],
'Landed Cost Master':'',
'Appraisal Template':'', 'Appraisal Template':'',
'Item Group':['All Item Groups', 'Default'], 'Item Group':['All Item Groups', 'Default'],
'Item':'', 'Item':'',