[fix] fixed merge conflict
This commit is contained in:
parent
46eaa55f06
commit
096d363087
@ -353,6 +353,7 @@ class DocType(BuyingController):
|
|||||||
# item gl entries
|
# item gl entries
|
||||||
stock_item_and_auto_accounting_for_stock = False
|
stock_item_and_auto_accounting_for_stock = False
|
||||||
stock_items = self.get_stock_items()
|
stock_items = self.get_stock_items()
|
||||||
|
rounding_diff = 0.0
|
||||||
for item in self.doclist.get({"parentfield": "entries"}):
|
for item in self.doclist.get({"parentfield": "entries"}):
|
||||||
if auto_accounting_for_stock and item.item_code in stock_items:
|
if auto_accounting_for_stock and item.item_code in stock_items:
|
||||||
if flt(item.valuation_rate):
|
if flt(item.valuation_rate):
|
||||||
@ -361,9 +362,13 @@ class DocType(BuyingController):
|
|||||||
# expense will be booked in sales invoice
|
# expense will be booked in sales invoice
|
||||||
stock_item_and_auto_accounting_for_stock = True
|
stock_item_and_auto_accounting_for_stock = True
|
||||||
|
|
||||||
valuation_amt = (flt(item.amount, self.precision("amount", item)) +
|
valuation_amt = flt(flt(item.valuation_rate) * flt(item.qty) * \
|
||||||
|
flt(item.conversion_factor), self.precision("valuation_rate", item))
|
||||||
|
|
||||||
|
rounding_diff += (flt(item.amount, self.precision("amount", item)) +
|
||||||
flt(item.item_tax_amount, self.precision("item_tax_amount", item)) +
|
flt(item.item_tax_amount, self.precision("item_tax_amount", item)) +
|
||||||
flt(item.rm_supp_cost, self.precision("rm_supp_cost", item)))
|
flt(item.rm_supp_cost, self.precision("rm_supp_cost", item)) -
|
||||||
|
valuation_amt)
|
||||||
|
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
@ -392,6 +397,12 @@ class DocType(BuyingController):
|
|||||||
expenses_included_in_valuation = \
|
expenses_included_in_valuation = \
|
||||||
self.get_company_default("expenses_included_in_valuation")
|
self.get_company_default("expenses_included_in_valuation")
|
||||||
|
|
||||||
|
if rounding_diff:
|
||||||
|
import operator
|
||||||
|
cost_center_with_max_value = max(valuation_tax.iteritems(),
|
||||||
|
key=operator.itemgetter(1))[0]
|
||||||
|
valuation_tax[cost_center_with_max_value] -= flt(rounding_diff)
|
||||||
|
|
||||||
for cost_center, amount in valuation_tax.items():
|
for cost_center, amount in valuation_tax.items():
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
|
@ -19,19 +19,19 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
onload: function() {
|
onload: function() {
|
||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
if(!this.frm.doc.__islocal) {
|
if(!this.frm.doc.__islocal && !this.frm.doc.customer && this.frm.doc.debit_to) {
|
||||||
// show debit_to in print format
|
// show debit_to in print format
|
||||||
if(!this.frm.doc.customer && this.frm.doc.debit_to) {
|
|
||||||
this.frm.set_df_property("debit_to", "print_hide", 0);
|
this.frm.set_df_property("debit_to", "print_hide", 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// toggle to pos view if is_pos is 1 in user_defaults
|
// toggle to pos view if is_pos is 1 in user_defaults
|
||||||
if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos) &&
|
if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos)) {
|
||||||
cint(wn.defaults.get_user_defaults("fs_pos_view"))===1) {
|
if(this.frm.doc.__islocal && !this.frm.doc.amended_from && !this.frm.doc.customer) {
|
||||||
if(this.frm.doc.__islocal && !this.frm.doc.amended_from) {
|
|
||||||
this.frm.set_value("is_pos", 1);
|
this.frm.set_value("is_pos", 1);
|
||||||
this.is_pos(function() {cur_frm.cscript.toggle_pos(true);});
|
this.is_pos(function() {
|
||||||
|
if (cint(wn.defaults.get_user_defaults("fs_pos_view"))===1)
|
||||||
|
cur_frm.cscript.toggle_pos(true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +141,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
me.frm.script_manager.trigger("update_stock");
|
me.frm.script_manager.trigger("update_stock");
|
||||||
|
me.set_default_values();
|
||||||
|
me.set_dynamic_labels();
|
||||||
|
me.calculate_taxes_and_totals();
|
||||||
|
|
||||||
if(callback_fn) callback_fn()
|
if(callback_fn) callback_fn()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,26 +383,8 @@ cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
|||||||
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
|
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.copy_account_in_all_row = function(doc, cdt, cdn, fieldname) {
|
|
||||||
var d = locals[cdt][cdn];
|
|
||||||
if(d[fieldname]){
|
|
||||||
var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
|
||||||
for(var i = 0; i < cl.length; i++){
|
|
||||||
if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
refresh_field(cur_frm.cscript.fname);
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
|
cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center");
|
||||||
if(d.cost_center){
|
|
||||||
var cl = getchildren('Sales Invoice Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
|
||||||
for(var i = 0; i < cl.length; i++){
|
|
||||||
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
refresh_field(cur_frm.cscript.fname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||||
|
@ -52,7 +52,6 @@ class DocType(SellingController):
|
|||||||
sales_com_obj = get_obj('Sales Common')
|
sales_com_obj = get_obj('Sales Common')
|
||||||
sales_com_obj.check_stop_sales_order(self)
|
sales_com_obj.check_stop_sales_order(self)
|
||||||
sales_com_obj.check_active_sales_items(self)
|
sales_com_obj.check_active_sales_items(self)
|
||||||
sales_com_obj.check_conversion_rate(self)
|
|
||||||
sales_com_obj.validate_max_discount(self, 'entries')
|
sales_com_obj.validate_max_discount(self, 'entries')
|
||||||
self.validate_customer_account()
|
self.validate_customer_account()
|
||||||
self.validate_debit_acc()
|
self.validate_debit_acc()
|
||||||
|
@ -52,7 +52,7 @@ class AccountsController(TransactionBase):
|
|||||||
msgprint(_("Account for this ") + fieldname + _(" has been freezed. ") +
|
msgprint(_("Account for this ") + fieldname + _(" has been freezed. ") +
|
||||||
self.doc.doctype + _(" can not be made."), raise_exception=1)
|
self.doc.doctype + _(" can not be made."), raise_exception=1)
|
||||||
|
|
||||||
def set_price_list_currency(self, buying_or_selling, for_validate=False):
|
def set_price_list_currency(self, buying_or_selling):
|
||||||
if self.meta.get_field("currency"):
|
if self.meta.get_field("currency"):
|
||||||
company_currency = get_company_currency(self.doc.company)
|
company_currency = get_company_currency(self.doc.company)
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ class AccountsController(TransactionBase):
|
|||||||
if self.doc.price_list_currency == company_currency:
|
if self.doc.price_list_currency == company_currency:
|
||||||
self.doc.plc_conversion_rate = 1.0
|
self.doc.plc_conversion_rate = 1.0
|
||||||
|
|
||||||
elif not self.doc.plc_conversion_rate or not for_validate:
|
elif not self.doc.plc_conversion_rate:
|
||||||
self.doc.plc_conversion_rate = self.get_exchange_rate(
|
self.doc.plc_conversion_rate = self.get_exchange_rate(
|
||||||
self.doc.price_list_currency, company_currency)
|
self.doc.price_list_currency, company_currency)
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class AccountsController(TransactionBase):
|
|||||||
self.doc.conversion_rate = self.doc.plc_conversion_rate
|
self.doc.conversion_rate = self.doc.plc_conversion_rate
|
||||||
elif self.doc.currency == company_currency:
|
elif self.doc.currency == company_currency:
|
||||||
self.doc.conversion_rate = 1.0
|
self.doc.conversion_rate = 1.0
|
||||||
elif not self.doc.conversion_rate or not for_validate:
|
elif not self.doc.conversion_rate:
|
||||||
self.doc.conversion_rate = self.get_exchange_rate(self.doc.currency,
|
self.doc.conversion_rate = self.get_exchange_rate(self.doc.currency,
|
||||||
company_currency)
|
company_currency)
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class BuyingController(StockController):
|
|||||||
super(BuyingController, self).set_missing_values(for_validate)
|
super(BuyingController, self).set_missing_values(for_validate)
|
||||||
|
|
||||||
self.set_supplier_from_item_default()
|
self.set_supplier_from_item_default()
|
||||||
self.set_price_list_currency("Buying", for_validate)
|
self.set_price_list_currency("Buying")
|
||||||
|
|
||||||
# set contact and address details for supplier, if they are not mentioned
|
# set contact and address details for supplier, if they are not mentioned
|
||||||
if self.doc.supplier and not (self.doc.contact_person and self.doc.supplier_address):
|
if self.doc.supplier and not (self.doc.contact_person and self.doc.supplier_address):
|
||||||
|
@ -23,7 +23,7 @@ class SellingController(StockController):
|
|||||||
|
|
||||||
# set contact and address details for customer, if they are not mentioned
|
# set contact and address details for customer, if they are not mentioned
|
||||||
self.set_missing_lead_customer_details()
|
self.set_missing_lead_customer_details()
|
||||||
self.set_price_list_and_item_details(for_validate)
|
self.set_price_list_and_item_details()
|
||||||
if self.doc.fields.get("__islocal"):
|
if self.doc.fields.get("__islocal"):
|
||||||
self.set_taxes("other_charges", "charge")
|
self.set_taxes("other_charges", "charge")
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ class SellingController(StockController):
|
|||||||
if not self.doc.fields.get(fieldname) and self.meta.get_field(fieldname):
|
if not self.doc.fields.get(fieldname) and self.meta.get_field(fieldname):
|
||||||
self.doc.fields[fieldname] = val
|
self.doc.fields[fieldname] = val
|
||||||
|
|
||||||
def set_price_list_and_item_details(self, for_validate=False):
|
def set_price_list_and_item_details(self):
|
||||||
self.set_price_list_currency("Selling", for_validate)
|
self.set_price_list_currency("Selling")
|
||||||
self.set_missing_item_details(get_item_details)
|
self.set_missing_item_details(get_item_details)
|
||||||
|
|
||||||
def get_other_charges(self):
|
def get_other_charges(self):
|
||||||
|
@ -20,7 +20,7 @@ An Item can have multiple prices based on customer, currency, region, shipping c
|
|||||||
|
|
||||||
> Setup > Item Price
|
> Setup > Item Price
|
||||||
|
|
||||||
- Enter Price List and Item Code, Valid for Buying or Selling, Item Name & Item Description will be automatically fetched.
|
- Enter Price List and Item Code, Valid for Buying or Selling, Item Name and Item Description will be automatically fetched.
|
||||||
- Enter Rate and save the document.
|
- Enter Rate and save the document.
|
||||||
|
|
||||||

|

|
||||||
|
@ -42,7 +42,7 @@ These numbers help to track individual units or batches of Items which you sell.
|
|||||||
|
|
||||||
> Important: Once you mark an item as serialized or batched or neither, you cannot change it after you have made any stock entry.
|
> Important: Once you mark an item as serialized or batched or neither, you cannot change it after you have made any stock entry.
|
||||||
|
|
||||||
- [Disucssion on Serialized Inventory](docs.user.stock.serialized.html)
|
- [Discussion on Serialized Inventory](docs.user.stock.serialized.html)
|
||||||
|
|
||||||
### Re Ordering
|
### Re Ordering
|
||||||
|
|
||||||
|
@ -332,9 +332,11 @@ def exec_in_shell(cmd):
|
|||||||
|
|
||||||
stdout.seek(0)
|
stdout.seek(0)
|
||||||
out = stdout.read()
|
out = stdout.read()
|
||||||
|
if out: out = out.decode('utf-8')
|
||||||
|
|
||||||
stderr.seek(0)
|
stderr.seek(0)
|
||||||
err = stderr.read()
|
err = stderr.read()
|
||||||
|
if err: err = err.decode('utf-8')
|
||||||
|
|
||||||
if err and any((kw in err.lower() for kw in ["traceback", "error", "exception"])):
|
if err and any((kw in err.lower() for kw in ["traceback", "error", "exception"])):
|
||||||
print out
|
print out
|
||||||
|
@ -18,6 +18,7 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
show_general_ledger: function() {
|
show_general_ledger: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
|
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
|
||||||
@ -30,5 +31,16 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
|||||||
wn.set_route("general-ledger");
|
wn.set_route("general-ledger");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
copy_account_in_all_row: function(doc, dt, dn, fieldname) {
|
||||||
|
var d = locals[dt][dn];
|
||||||
|
if(d[fieldname]){
|
||||||
|
var cl = getchildren(this.frm.cscript.tname, doc.name, this.frm.cscript.fname, doc.doctype);
|
||||||
|
for(var i = 0; i < cl.length; i++) {
|
||||||
|
if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
refresh_field(this.frm.cscript.fname);
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -25,8 +25,6 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname])
|
if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname])
|
||||||
me.frm.set_value(fieldname, value);
|
me.frm.set_value(fieldname, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
me.frm.script_manager.trigger("company");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.other_fname) {
|
if(this.other_fname) {
|
||||||
@ -39,9 +37,9 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onload_post_render: function() {
|
onload_post_render: function() {
|
||||||
if(this.frm.doc.__islocal && this.frm.doc.company &&
|
|
||||||
!this.frm.doc.customer && !this.frm.doc.is_pos) {
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
if(this.frm.doc.__islocal && this.frm.doc.company && !this.frm.doc.is_pos) {
|
||||||
|
if(!this.frm.doc.customer || !this.frm.doc.supplier) {
|
||||||
return this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "onload_post_render",
|
method: "onload_post_render",
|
||||||
@ -50,8 +48,12 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
// remove this call when using client side mapper
|
// remove this call when using client side mapper
|
||||||
me.set_default_values();
|
me.set_default_values();
|
||||||
me.set_dynamic_labels();
|
me.set_dynamic_labels();
|
||||||
|
me.calculate_taxes_and_totals();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.calculate_taxes_and_totals();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -169,12 +171,12 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
conversion_rate: function() {
|
conversion_rate: function() {
|
||||||
if(this.frm.doc.currency === this.get_company_currency()) {
|
if(this.frm.doc.currency === this.get_company_currency()) {
|
||||||
this.frm.set_value("conversion_rate", 1.0);
|
this.frm.set_value("conversion_rate", 1.0);
|
||||||
} else if(this.frm.doc.currency === this.frm.doc.price_list_currency &&
|
}
|
||||||
|
if(this.frm.doc.currency === this.frm.doc.price_list_currency &&
|
||||||
this.frm.doc.plc_conversion_rate !== this.frm.doc.conversion_rate) {
|
this.frm.doc.plc_conversion_rate !== this.frm.doc.conversion_rate) {
|
||||||
this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate);
|
this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate);
|
||||||
}
|
}
|
||||||
|
if(flt(this.frm.doc.conversion_rate)>0.0) this.calculate_taxes_and_totals();
|
||||||
this.calculate_taxes_and_totals();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
get_price_list_currency: function(buying_or_selling) {
|
get_price_list_currency: function(buying_or_selling) {
|
||||||
@ -224,7 +226,8 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
plc_conversion_rate: function() {
|
plc_conversion_rate: function() {
|
||||||
if(this.frm.doc.price_list_currency === this.get_company_currency()) {
|
if(this.frm.doc.price_list_currency === this.get_company_currency()) {
|
||||||
this.frm.set_value("plc_conversion_rate", 1.0);
|
this.frm.set_value("plc_conversion_rate", 1.0);
|
||||||
} else if(this.frm.doc.price_list_currency === this.frm.doc.currency) {
|
}
|
||||||
|
if(this.frm.doc.price_list_currency === this.frm.doc.currency) {
|
||||||
this.frm.set_value("conversion_rate", this.frm.doc.plc_conversion_rate);
|
this.frm.set_value("conversion_rate", this.frm.doc.plc_conversion_rate);
|
||||||
this.calculate_taxes_and_totals();
|
this.calculate_taxes_and_totals();
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,6 @@ class DocType(SellingController):
|
|||||||
sales_com_obj = get_obj('Sales Common')
|
sales_com_obj = get_obj('Sales Common')
|
||||||
sales_com_obj.check_active_sales_items(self)
|
sales_com_obj.check_active_sales_items(self)
|
||||||
sales_com_obj.validate_max_discount(self,'quotation_details')
|
sales_com_obj.validate_max_discount(self,'quotation_details')
|
||||||
sales_com_obj.check_conversion_rate(self)
|
|
||||||
|
|
||||||
#update enquiry
|
#update enquiry
|
||||||
#------------------
|
#------------------
|
||||||
|
@ -9,7 +9,6 @@ from webnotes.model.doc import addchild
|
|||||||
from webnotes.model.bean import getlist
|
from webnotes.model.bean import getlist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint, _
|
from webnotes import msgprint, _
|
||||||
from setup.utils import get_company_currency
|
|
||||||
|
|
||||||
get_value = webnotes.conn.get_value
|
get_value = webnotes.conn.get_value
|
||||||
|
|
||||||
@ -74,19 +73,6 @@ class DocType(TransactionBase):
|
|||||||
msgprint("You cannot give more than " + cstr(discount[0]['max_discount']) + " % discount on Item Code : "+cstr(d.item_code))
|
msgprint("You cannot give more than " + cstr(discount[0]['max_discount']) + " % discount on Item Code : "+cstr(d.item_code))
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
# Check Conversion Rate (i.e. it will not allow conversion rate to be 1 for Currency other than default currency set in Global Defaults)
|
|
||||||
# ===========================================================================
|
|
||||||
def check_conversion_rate(self, obj):
|
|
||||||
default_currency = get_company_currency(obj.doc.company)
|
|
||||||
if not default_currency:
|
|
||||||
msgprint('Message: Please enter default currency in Company Master')
|
|
||||||
raise Exception
|
|
||||||
if (obj.doc.currency == default_currency and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != default_currency and flt(obj.doc.conversion_rate) == 1.00):
|
|
||||||
msgprint("Please Enter Appropriate Conversion Rate for Customer's Currency to Base Currency (%s --> %s)" % (obj.doc.currency, default_currency), raise_exception = 1)
|
|
||||||
|
|
||||||
if (obj.doc.price_list_currency == default_currency and flt(obj.doc.plc_conversion_rate) != 1.00) or not obj.doc.plc_conversion_rate or (obj.doc.price_list_currency != default_currency and flt(obj.doc.plc_conversion_rate) == 1.00):
|
|
||||||
msgprint("Please Enter Appropriate Conversion Rate for Price List Currency to Base Currency (%s --> %s)" % (obj.doc.price_list_currency, default_currency), raise_exception = 1)
|
|
||||||
|
|
||||||
def get_item_list(self, obj, is_stopped=0):
|
def get_item_list(self, obj, is_stopped=0):
|
||||||
"""get item list"""
|
"""get item list"""
|
||||||
il = []
|
il = []
|
||||||
|
@ -126,7 +126,7 @@ class DocType(SellingController):
|
|||||||
self.validate_warehouse()
|
self.validate_warehouse()
|
||||||
sales_com_obj = get_obj(dt = 'Sales Common')
|
sales_com_obj = get_obj(dt = 'Sales Common')
|
||||||
sales_com_obj.check_active_sales_items(self)
|
sales_com_obj.check_active_sales_items(self)
|
||||||
sales_com_obj.check_conversion_rate(self)
|
|
||||||
|
|
||||||
sales_com_obj.validate_max_discount(self,'sales_order_details')
|
sales_com_obj.validate_max_discount(self,'sales_order_details')
|
||||||
self.doclist = sales_com_obj.make_packing_list(self,'sales_order_details')
|
self.doclist = sales_com_obj.make_packing_list(self,'sales_order_details')
|
||||||
|
@ -91,7 +91,7 @@ class DocType(SellingController):
|
|||||||
self.validate_uom_is_integer("stock_uom", "qty")
|
self.validate_uom_is_integer("stock_uom", "qty")
|
||||||
|
|
||||||
sales_com_obj.validate_max_discount(self, 'delivery_note_details')
|
sales_com_obj.validate_max_discount(self, 'delivery_note_details')
|
||||||
sales_com_obj.check_conversion_rate(self)
|
|
||||||
|
|
||||||
# Set actual qty for each item in selected warehouse
|
# Set actual qty for each item in selected warehouse
|
||||||
self.update_current_stock()
|
self.update_current_stock()
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
cur_frm.cscript.tname = "Stock Entry Detail";
|
||||||
|
cur_frm.cscript.fname = "mtn_details";
|
||||||
|
|
||||||
wn.require("public/app/js/controllers/stock_controller.js");
|
wn.require("public/app/js/controllers/stock_controller.js");
|
||||||
wn.provide("erpnext.stock");
|
wn.provide("erpnext.stock");
|
||||||
|
|
||||||
@ -112,12 +115,6 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
entries_add: function(doc, cdt, cdn) {
|
|
||||||
var row = wn.model.get_doc(cdt, cdn);
|
|
||||||
this.frm.script_manager.copy_from_first_row("mtn_details", row,
|
|
||||||
["expense_account", "cost_center"]);
|
|
||||||
},
|
|
||||||
|
|
||||||
clean_up: function() {
|
clean_up: function() {
|
||||||
// Clear Production Order record from locals, because it is updated via Stock Entry
|
// Clear Production Order record from locals, because it is updated via Stock Entry
|
||||||
if(this.frm.doc.production_order &&
|
if(this.frm.doc.production_order &&
|
||||||
@ -224,6 +221,8 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
mtn_details_add: function(doc, cdt, cdn) {
|
mtn_details_add: function(doc, cdt, cdn) {
|
||||||
var row = wn.model.get_doc(cdt, cdn);
|
var row = wn.model.get_doc(cdt, cdn);
|
||||||
|
this.frm.script_manager.copy_from_first_row("mtn_details", row,
|
||||||
|
["expense_account", "cost_center"]);
|
||||||
|
|
||||||
if(!row.s_warehouse) row.s_warehouse = this.frm.doc.from_warehouse;
|
if(!row.s_warehouse) row.s_warehouse = this.frm.doc.from_warehouse;
|
||||||
if(!row.t_warehouse) row.t_warehouse = this.frm.doc.to_warehouse;
|
if(!row.t_warehouse) row.t_warehouse = this.frm.doc.to_warehouse;
|
||||||
@ -261,23 +260,28 @@ cur_frm.cscript.toggle_related_fields = function(doc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.delivery_note_no = function(doc, cdt, cdn) {
|
cur_frm.cscript.delivery_note_no = function(doc, cdt, cdn) {
|
||||||
if(doc.delivery_note_no) return get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
if(doc.delivery_note_no)
|
||||||
|
return get_server_fields('get_cust_values', '', '', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.sales_invoice_no = function(doc, cdt, cdn) {
|
cur_frm.cscript.sales_invoice_no = function(doc, cdt, cdn) {
|
||||||
if(doc.sales_invoice_no) return get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
if(doc.sales_invoice_no)
|
||||||
|
return get_server_fields('get_cust_values', '', '', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.customer = function(doc, cdt, cdn) {
|
cur_frm.cscript.customer = function(doc, cdt, cdn) {
|
||||||
if(doc.customer) return get_server_fields('get_cust_addr','','',doc,cdt,cdn,1);
|
if(doc.customer)
|
||||||
|
return get_server_fields('get_cust_addr', '', '', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.purchase_receipt_no = function(doc, cdt, cdn) {
|
cur_frm.cscript.purchase_receipt_no = function(doc, cdt, cdn) {
|
||||||
if(doc.purchase_receipt_no) return get_server_fields('get_supp_values','','',doc,cdt,cdn,1);
|
if(doc.purchase_receipt_no)
|
||||||
|
return get_server_fields('get_supp_values', '', '', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.supplier = function(doc, cdt, cdn) {
|
cur_frm.cscript.supplier = function(doc, cdt, cdn) {
|
||||||
if(doc.supplier) return get_server_fields('get_supp_addr','','',doc,cdt,cdn,1);
|
if(doc.supplier)
|
||||||
|
return get_server_fields('get_supp_addr', '', '', doc, cdt, cdn, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,9 +322,13 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
|||||||
'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse),
|
'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse),
|
||||||
'transfer_qty' : d.transfer_qty,
|
'transfer_qty' : d.transfer_qty,
|
||||||
'serial_no' : d.serial_no,
|
'serial_no' : d.serial_no,
|
||||||
'bom_no' : d.bom_no
|
'bom_no' : d.bom_no,
|
||||||
|
'expense_account' : d.expense_account,
|
||||||
|
'cost_center' : d.cost_center,
|
||||||
|
'company' : cur_frm.doc.company
|
||||||
};
|
};
|
||||||
return get_server_fields('get_item_details',JSON.stringify(args),'mtn_details',doc,cdt,cdn,1);
|
return get_server_fields('get_item_details', JSON.stringify(args),
|
||||||
|
'mtn_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
||||||
@ -343,7 +351,8 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
|||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.uom && d.item_code){
|
if(d.uom && d.item_code){
|
||||||
var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
|
var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
|
||||||
return get_server_fields('get_uom_details',JSON.stringify(arg),'mtn_details', doc, cdt, cdn, 1);
|
return get_server_fields('get_uom_details', JSON.stringify(arg),
|
||||||
|
'mtn_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,8 +370,18 @@ cur_frm.cscript.validate_items = function(doc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.expense_account = function(doc, cdt, cdn) {
|
||||||
|
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "expense_account");
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.cost_center = function(doc, cdt, cdn) {
|
||||||
|
cur_frm.cscript.copy_account_in_all_row(doc, cdt, cdn, "cost_center");
|
||||||
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.customer.get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict.customer.get_query = function(doc, cdt, cdn) {
|
||||||
return{ query:"controllers.queries.customer_query" } }
|
return{ query:"controllers.queries.customer_query" }
|
||||||
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict.supplier.get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict.supplier.get_query = function(doc, cdt, cdn) {
|
||||||
return{ query:"controllers.queries.supplier_query" } }
|
return{ query:"controllers.queries.supplier_query" }
|
||||||
|
}
|
@ -367,7 +367,8 @@ class DocType(StockController):
|
|||||||
def get_item_details(self, arg):
|
def get_item_details(self, arg):
|
||||||
arg = json.loads(arg)
|
arg = json.loads(arg)
|
||||||
|
|
||||||
item = webnotes.conn.sql("""select stock_uom, description, item_name from `tabItem`
|
item = webnotes.conn.sql("""select stock_uom, description, item_name,
|
||||||
|
purchase_account, cost_center from `tabItem`
|
||||||
where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00'
|
where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00'
|
||||||
or end_of_life > now())""", (arg.get('item_code')), as_dict = 1)
|
or end_of_life > now())""", (arg.get('item_code')), as_dict = 1)
|
||||||
if not item:
|
if not item:
|
||||||
@ -378,6 +379,9 @@ class DocType(StockController):
|
|||||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||||
'description' : item and item[0]['description'] or '',
|
'description' : item and item[0]['description'] or '',
|
||||||
'item_name' : item and item[0]['item_name'] or '',
|
'item_name' : item and item[0]['item_name'] or '',
|
||||||
|
'expense_account' : item and item[0]['purchase_account'] or arg.get("expense_account") \
|
||||||
|
or webnotes.conn.get_value("Company", arg.get("company"), "default_expense_account"),
|
||||||
|
'cost_center' : item and item[0]['cost_center'] or arg.get("cost_center"),
|
||||||
'qty' : 0,
|
'qty' : 0,
|
||||||
'transfer_qty' : 0,
|
'transfer_qty' : 0,
|
||||||
'conversion_factor' : 1,
|
'conversion_factor' : 1,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-03-29 18:22:12",
|
"creation": "2013-03-29 18:22:12",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-08-28 19:25:38",
|
"modified": "2013-10-15 14:58:09",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -154,6 +154,7 @@
|
|||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"default": ":Company",
|
||||||
"depends_on": "eval:sys_defaults.auto_accounting_for_stock",
|
"depends_on": "eval:sys_defaults.auto_accounting_for_stock",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "cost_center",
|
"fieldname": "cost_center",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user