commit
1c5fb9495e
@ -206,11 +206,11 @@ erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
|
|||||||
if(me.pl_or_bs=='Balance Sheet') {
|
if(me.pl_or_bs=='Balance Sheet') {
|
||||||
$.each(me.data, function(i, ac) {
|
$.each(me.data, function(i, ac) {
|
||||||
if((ac.rgt - ac.lft)==1 && ac.report_type=='Balance Sheet') {
|
if((ac.rgt - ac.lft)==1 && ac.report_type=='Balance Sheet') {
|
||||||
var opening = 0;
|
var opening = flt(ac["opening_dr"]) - flt(ac["opening_cr"]);
|
||||||
//if(opening) throw opening;
|
//if(opening) throw opening;
|
||||||
$.each(me.columns, function(i, col) {
|
$.each(me.columns, function(i, col) {
|
||||||
if(col.formatter==me.currency_formatter) {
|
if(col.formatter==me.currency_formatter) {
|
||||||
if(col.balance_type=="Dr") {
|
if(col.balance_type=="Dr" && !in_list(["opening_dr", "opening_cr"], col.field)) {
|
||||||
opening = opening + flt(ac[col.date + "_dr"]) -
|
opening = opening + flt(ac[col.date + "_dr"]) -
|
||||||
flt(ac[col.date + "_cr"]);
|
flt(ac[col.date + "_cr"]);
|
||||||
me.set_debit_or_credit(ac, col.date, opening);
|
me.set_debit_or_credit(ac, col.date, opening);
|
||||||
|
@ -68,13 +68,14 @@ class DeliveryNote(SellingController):
|
|||||||
self.validate_for_items()
|
self.validate_for_items()
|
||||||
self.validate_warehouse()
|
self.validate_warehouse()
|
||||||
self.validate_uom_is_integer("stock_uom", "qty")
|
self.validate_uom_is_integer("stock_uom", "qty")
|
||||||
self.update_current_stock()
|
|
||||||
self.validate_with_previous_doc()
|
self.validate_with_previous_doc()
|
||||||
|
|
||||||
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
|
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
|
||||||
make_packing_list(self, 'delivery_note_details')
|
make_packing_list(self, 'delivery_note_details')
|
||||||
|
|
||||||
self.status = 'Draft'
|
self.update_current_stock()
|
||||||
|
|
||||||
|
if not self.status: self.status = 'Draft'
|
||||||
if not self.installation_status: self.installation_status = 'Not Installed'
|
if not self.installation_status: self.installation_status = 'Not Installed'
|
||||||
|
|
||||||
def validate_with_previous_doc(self):
|
def validate_with_previous_doc(self):
|
||||||
@ -133,14 +134,17 @@ class DeliveryNote(SellingController):
|
|||||||
|
|
||||||
|
|
||||||
def update_current_stock(self):
|
def update_current_stock(self):
|
||||||
|
if self._action != "update_after_submit":
|
||||||
for d in self.get('delivery_note_details'):
|
for d in self.get('delivery_note_details'):
|
||||||
bin = frappe.db.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
d.actual_qty = frappe.db.get_value("Bin", {"item_code": d.item_code,
|
||||||
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
"warehouse": d.warehouse}, "actual_qty")
|
||||||
|
|
||||||
for d in self.get('packing_details'):
|
for d in self.get('packing_details'):
|
||||||
bin = frappe.db.sql("select actual_qty, projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
bin_qty = frappe.db.get_value("Bin", {"item_code": d.item_code,
|
||||||
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
"warehouse": d.warehouse}, ["actual_qty", "projected_qty"], as_dict=True)
|
||||||
d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
|
if bin_qty:
|
||||||
|
d.actual_qty = flt(bin_qty.actual_qty)
|
||||||
|
d.projected_qty = flt(bin_qty.projected_qty)
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.validate_packed_qty()
|
self.validate_packed_qty()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user