Merge branch 'develop'
This commit is contained in:
commit
72f8ae2d5a
@ -146,11 +146,12 @@ def update_outstanding_amt(account, against_voucher_type, against_voucher, on_ca
|
|||||||
webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" %
|
webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" %
|
||||||
(against_voucher_type, bal, against_voucher))
|
(against_voucher_type, bal, against_voucher))
|
||||||
|
|
||||||
def validate_frozen_account(account, adv_adj):
|
def validate_frozen_account(account, adv_adj=None):
|
||||||
frozen_account = webnotes.conn.get_value("Account", account, "freeze_account")
|
frozen_account = webnotes.conn.get_value("Account", account, "freeze_account")
|
||||||
if frozen_account == 'Yes' and not adv_adj:
|
if frozen_account == 'Yes' and not adv_adj:
|
||||||
frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None,
|
frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None,
|
||||||
'frozen_accounts_modifier')
|
'frozen_accounts_modifier')
|
||||||
|
|
||||||
if not frozen_accounts_modifier:
|
if not frozen_accounts_modifier:
|
||||||
webnotes.throw(account + _(" is a frozen account. \
|
webnotes.throw(account + _(" is a frozen account. \
|
||||||
Either make the account active or assign role in Accounts Settings \
|
Either make the account active or assign role in Accounts Settings \
|
||||||
|
|||||||
@ -19,8 +19,10 @@ erpnext.POS = Class.extend({
|
|||||||
<table class="table table-condensed table-hover" id="cart" style="table-layout: fixed;">\
|
<table class="table table-condensed table-hover" id="cart" style="table-layout: fixed;">\
|
||||||
<thead>\
|
<thead>\
|
||||||
<tr>\
|
<tr>\
|
||||||
<th style="width: 50%">Item</th>\
|
<th style="width: 40%">Item</th>\
|
||||||
<th style="width: 25%; text-align: right;">Qty</th>\
|
<th style="width: 9%"></th>\
|
||||||
|
<th style="width: 17%; text-align: right;">Qty</th>\
|
||||||
|
<th style="width: 9%"></th>\
|
||||||
<th style="width: 25%; text-align: right;">Rate</th>\
|
<th style="width: 25%; text-align: right;">Rate</th>\
|
||||||
</tr>\
|
</tr>\
|
||||||
</thead>\
|
</thead>\
|
||||||
@ -60,10 +62,16 @@ erpnext.POS = Class.extend({
|
|||||||
</div>\
|
</div>\
|
||||||
</div>\
|
</div>\
|
||||||
<br><br>\
|
<br><br>\
|
||||||
|
<div class="row">\
|
||||||
|
<div class="col-sm-9">\
|
||||||
<button class="btn btn-success btn-lg make-payment">\
|
<button class="btn btn-success btn-lg make-payment">\
|
||||||
<i class="icon-money"></i> Make Payment</button>\
|
<i class="icon-money"></i> Make Payment</button>\
|
||||||
<button class="btn btn-default btn-lg delete-items pull-right" style="display: none;">\
|
</div>\
|
||||||
|
<div class="col-sm-3">\
|
||||||
|
<button class="btn btn-default btn-lg remove-items" style="display: none;">\
|
||||||
<i class="icon-trash"></i> Del</button>\
|
<i class="icon-trash"></i> Del</button>\
|
||||||
|
</div>\
|
||||||
|
</div>\
|
||||||
<br><br>\
|
<br><br>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="col-sm-6">\
|
<div class="col-sm-6">\
|
||||||
@ -82,7 +90,7 @@ erpnext.POS = Class.extend({
|
|||||||
me.refresh();
|
me.refresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.call_function("delete-items", function() {me.remove_selected_item();});
|
this.call_function("remove-items", function() {me.remove_selected_items();});
|
||||||
this.call_function("make-payment", function() {me.make_payment();});
|
this.call_function("make-payment", function() {me.make_payment();});
|
||||||
},
|
},
|
||||||
check_transaction_type: function() {
|
check_transaction_type: function() {
|
||||||
@ -333,7 +341,7 @@ erpnext.POS = Class.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.disable_text_box_and_button();
|
this.disable_text_box_and_button();
|
||||||
this.make_payment_button();
|
this.hide_payment_button();
|
||||||
|
|
||||||
// If quotation to is not Customer then remove party
|
// If quotation to is not Customer then remove party
|
||||||
if (this.frm.doctype == "Quotation") {
|
if (this.frm.doctype == "Quotation") {
|
||||||
@ -351,8 +359,18 @@ erpnext.POS = Class.extend({
|
|||||||
|
|
||||||
$(repl('<tr id="%(item_code)s" data-selected="false">\
|
$(repl('<tr id="%(item_code)s" data-selected="false">\
|
||||||
<td>%(item_code)s%(item_name)s</td>\
|
<td>%(item_code)s%(item_name)s</td>\
|
||||||
<td><input type="text" value="%(qty)s" \
|
<td style="vertical-align:middle;" align="right">\
|
||||||
|
<div class="decrease-qty" style="cursor:pointer;">\
|
||||||
|
<i class="icon-minus-sign icon-large text-danger"></i>\
|
||||||
|
</div>\
|
||||||
|
</td>\
|
||||||
|
<td style="vertical-align:middle;"><input type="text" value="%(qty)s" \
|
||||||
class="form-control qty" style="text-align: right;"></td>\
|
class="form-control qty" style="text-align: right;"></td>\
|
||||||
|
<td style="vertical-align:middle;cursor:pointer;">\
|
||||||
|
<div class="increase-qty" style="cursor:pointer;">\
|
||||||
|
<i class="icon-plus-sign icon-large text-success"></i>\
|
||||||
|
</div>\
|
||||||
|
</td>\
|
||||||
<td style="text-align: right;"><b>%(amount)s</b><br>%(rate)s</td>\
|
<td style="text-align: right;"><b>%(amount)s</b><br>%(rate)s</td>\
|
||||||
</tr>',
|
</tr>',
|
||||||
{
|
{
|
||||||
@ -364,18 +382,22 @@ erpnext.POS = Class.extend({
|
|||||||
}
|
}
|
||||||
)).appendTo($items);
|
)).appendTo($items);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.wrapper.find(".increase-qty, .decrease-qty").on("click", function() {
|
||||||
|
var item_code = $(this).closest("tr").attr("id");
|
||||||
|
me.selected_item_qty_operation(item_code, $(this).attr("class"));
|
||||||
|
});
|
||||||
},
|
},
|
||||||
show_taxes: function() {
|
show_taxes: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var taxes = wn.model.get_children(this.sales_or_purchase + " Taxes and Charges",
|
var taxes = wn.model.get_children(this.sales_or_purchase + " Taxes and Charges",
|
||||||
this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype);
|
this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype);
|
||||||
$(this.wrapper).find(".tax-table")
|
$(this.wrapper).find(".tax-table")
|
||||||
.toggle((taxes && taxes.length &&
|
.toggle((taxes && taxes.length) ? true : false)
|
||||||
flt(me.frm.doc.other_charges_total_export ||
|
|
||||||
me.frm.doc.other_charges_added_import) != 0.0) ? true : false)
|
|
||||||
.find("tbody").empty();
|
.find("tbody").empty();
|
||||||
|
|
||||||
$.each(taxes, function(i, d) {
|
$.each(taxes, function(i, d) {
|
||||||
|
if (d.tax_amount) {
|
||||||
$(repl('<tr>\
|
$(repl('<tr>\
|
||||||
<td>%(description)s %(rate)s</td>\
|
<td>%(description)s %(rate)s</td>\
|
||||||
<td style="text-align: right;">%(tax_amount)s</td>\
|
<td style="text-align: right;">%(tax_amount)s</td>\
|
||||||
@ -385,6 +407,7 @@ erpnext.POS = Class.extend({
|
|||||||
tax_amount: format_currency(flt(d.tax_amount)/flt(me.frm.doc.conversion_rate),
|
tax_amount: format_currency(flt(d.tax_amount)/flt(me.frm.doc.conversion_rate),
|
||||||
me.frm.doc.currency)
|
me.frm.doc.currency)
|
||||||
})).appendTo(".tax-table tbody");
|
})).appendTo(".tax-table tbody");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
set_totals: function() {
|
set_totals: function() {
|
||||||
@ -427,7 +450,7 @@ erpnext.POS = Class.extend({
|
|||||||
$(this.wrapper).find('input, button').each(function () {
|
$(this.wrapper).find('input, button').each(function () {
|
||||||
$(this).prop('disabled', true);
|
$(this).prop('disabled', true);
|
||||||
});
|
});
|
||||||
$(this.wrapper).find(".delete-items").hide();
|
$(this.wrapper).find(".remove-items").hide();
|
||||||
$(this.wrapper).find(".make-payment").hide();
|
$(this.wrapper).find(".make-payment").hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -437,14 +460,14 @@ erpnext.POS = Class.extend({
|
|||||||
$(this.wrapper).find(".make-payment").show();
|
$(this.wrapper).find(".make-payment").show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
make_payment_button: function() {
|
hide_payment_button: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
// Show Make Payment button only in Sales Invoice
|
// Show Make Payment button only in Sales Invoice
|
||||||
if (this.frm.doctype != "Sales Invoice")
|
if (this.frm.doctype != "Sales Invoice")
|
||||||
$(this.wrapper).find(".make-payment").hide();
|
$(this.wrapper).find(".make-payment").hide();
|
||||||
},
|
},
|
||||||
refresh_delete_btn: function() {
|
refresh_delete_btn: function() {
|
||||||
$(this.wrapper).find(".delete-items").toggle($(".item-cart .warning").length ? true : false);
|
$(this.wrapper).find(".remove-items").toggle($(".item-cart .warning").length ? true : false);
|
||||||
},
|
},
|
||||||
add_item_thru_barcode: function() {
|
add_item_thru_barcode: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
@ -466,7 +489,7 @@ erpnext.POS = Class.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
remove_selected_item: function() {
|
remove_selected_items: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var selected_items = [];
|
var selected_items = [];
|
||||||
var no_of_items = $(this.wrapper).find("#cart tbody tr").length;
|
var no_of_items = $(this.wrapper).find("#cart tbody tr").length;
|
||||||
@ -487,6 +510,7 @@ erpnext.POS = Class.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.refresh_grid();
|
this.refresh_grid();
|
||||||
},
|
},
|
||||||
refresh_grid: function() {
|
refresh_grid: function() {
|
||||||
@ -494,6 +518,22 @@ erpnext.POS = Class.extend({
|
|||||||
this.frm.script_manager.trigger("calculate_taxes_and_totals");
|
this.frm.script_manager.trigger("calculate_taxes_and_totals");
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
},
|
||||||
|
selected_item_qty_operation: function(item_code, operation) {
|
||||||
|
var me = this;
|
||||||
|
var child = wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
||||||
|
this.frm.cscript.fname, this.frm.doctype);
|
||||||
|
|
||||||
|
$.each(child, function(i, d) {
|
||||||
|
if (d.item_code == item_code) {
|
||||||
|
if (operation == "increase-qty")
|
||||||
|
d.qty += 1;
|
||||||
|
else if (operation == "decrease-qty")
|
||||||
|
d.qty != 1 ? d.qty -= 1 : d.qty = 1;
|
||||||
|
|
||||||
|
me.refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
make_payment: function() {
|
make_payment: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var no_of_items = $(this.wrapper).find("#cart tbody tr").length;
|
var no_of_items = $(this.wrapper).find("#cart tbody tr").length;
|
||||||
|
|||||||
@ -8,6 +8,7 @@ wn.query_reports["Bank Reconciliation Statement"] = {
|
|||||||
"label": wn._("Bank Account"),
|
"label": wn._("Bank Account"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Account",
|
"options": "Account",
|
||||||
|
"reqd": 1,
|
||||||
"get_query": function() {
|
"get_query": function() {
|
||||||
return {
|
return {
|
||||||
"query": "accounts.utils.get_account_list",
|
"query": "accounts.utils.get_account_list",
|
||||||
@ -22,7 +23,8 @@ wn.query_reports["Bank Reconciliation Statement"] = {
|
|||||||
"fieldname":"report_date",
|
"fieldname":"report_date",
|
||||||
"label": wn._("Date"),
|
"label": wn._("Date"),
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"default": get_today()
|
"default": get_today(),
|
||||||
|
"reqd": 1
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -3,12 +3,13 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import _, msgprint
|
|
||||||
from webnotes.utils import flt
|
from webnotes.utils import flt
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
if not filters: filters = {}
|
if not filters: filters = {}
|
||||||
|
|
||||||
|
debit_or_credit = webnotes.conn.get_value("Account", filters["account"], "debit_or_credit")
|
||||||
|
|
||||||
columns = get_columns()
|
columns = get_columns()
|
||||||
data = get_entries(filters)
|
data = get_entries(filters)
|
||||||
|
|
||||||
@ -20,47 +21,39 @@ def execute(filters=None):
|
|||||||
total_debit += flt(d[4])
|
total_debit += flt(d[4])
|
||||||
total_credit += flt(d[5])
|
total_credit += flt(d[5])
|
||||||
|
|
||||||
if webnotes.conn.get_value("Account", filters["account"], "debit_or_credit") == 'Debit':
|
if debit_or_credit == 'Debit':
|
||||||
bank_bal = flt(balance_as_per_company) - flt(total_debit) + flt(total_credit)
|
bank_bal = flt(balance_as_per_company) - flt(total_debit) + flt(total_credit)
|
||||||
else:
|
else:
|
||||||
bank_bal = flt(balance_as_per_company) + flt(total_debit) - flt(total_credit)
|
bank_bal = flt(balance_as_per_company) + flt(total_debit) - flt(total_credit)
|
||||||
|
|
||||||
data += [
|
data += [
|
||||||
["", "", "", "Balance as per company books", balance_as_per_company, ""],
|
get_balance_row("Balance as per company books", balance_as_per_company, debit_or_credit),
|
||||||
["", "", "", "Amounts not reflected in bank", total_debit, total_credit],
|
["", "", "", "Amounts not reflected in bank", total_debit, total_credit],
|
||||||
["", "", "", "Balance as per bank", bank_bal, ""]
|
get_balance_row("Balance as per bank", bank_bal, debit_or_credit)
|
||||||
]
|
]
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
|
|
||||||
def get_columns():
|
def get_columns():
|
||||||
return ["Journal Voucher:Link/Journal Voucher:140", "Posting Date:Date:100",
|
return ["Journal Voucher:Link/Journal Voucher:140", "Posting Date:Date:100",
|
||||||
"Clearance Date:Date:110", "Against Account:Link/Account:200",
|
"Clearance Date:Date:110", "Against Account:Link/Account:200",
|
||||||
"Debit:Currency:120", "Credit:Currency:120"
|
"Debit:Currency:120", "Credit:Currency:120"
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_conditions(filters):
|
|
||||||
conditions = ""
|
|
||||||
if not filters.get("account"):
|
|
||||||
msgprint(_("Please select Bank Account"), raise_exception=1)
|
|
||||||
else:
|
|
||||||
conditions += " and jvd.account = %(account)s"
|
|
||||||
|
|
||||||
if not filters.get("report_date"):
|
|
||||||
msgprint(_("Please select Date on which you want to run the report"), raise_exception=1)
|
|
||||||
else:
|
|
||||||
conditions += """ and jv.posting_date <= %(report_date)s
|
|
||||||
and ifnull(jv.clearance_date, '4000-01-01') > %(report_date)s"""
|
|
||||||
|
|
||||||
return conditions
|
|
||||||
|
|
||||||
def get_entries(filters):
|
def get_entries(filters):
|
||||||
conditions = get_conditions(filters)
|
entries = webnotes.conn.sql("""select
|
||||||
entries = webnotes.conn.sql("""select jv.name, jv.posting_date, jv.clearance_date,
|
jv.name, jv.posting_date, jv.clearance_date, jvd.against_account, jvd.debit, jvd.credit
|
||||||
jvd.against_account, jvd.debit, jvd.credit
|
from
|
||||||
from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
|
`tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
|
||||||
where jvd.parent = jv.name and jv.docstatus=1 and ifnull(jv.cheque_no, '')!= '' %s
|
where jvd.parent = jv.name and jv.docstatus=1 and ifnull(jv.cheque_no, '')!= ''
|
||||||
order by jv.name DESC""" % conditions, filters, as_list=1)
|
and jvd.account = %(account)s and jv.posting_date <= %(report_date)s
|
||||||
|
and ifnull(jv.clearance_date, '4000-01-01') > %(report_date)s
|
||||||
|
order by jv.name DESC""", filters, as_list=1)
|
||||||
|
|
||||||
return entries
|
return entries
|
||||||
|
|
||||||
|
def get_balance_row(label, amount, debit_or_credit):
|
||||||
|
if debit_or_credit == "Debit":
|
||||||
|
return ["", "", "", label, amount, 0]
|
||||||
|
else:
|
||||||
|
return ["", "", "", label, 0, amount]
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"app_name": "ERPNext",
|
"app_name": "ERPNext",
|
||||||
"app_version": "3.5.1",
|
"app_version": "3.6.0",
|
||||||
"base_template": "app/portal/templates/base.html",
|
"base_template": "app/portal/templates/base.html",
|
||||||
"modules": {
|
"modules": {
|
||||||
"Accounts": {
|
"Accounts": {
|
||||||
@ -74,5 +74,5 @@
|
|||||||
"type": "module"
|
"type": "module"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requires_framework_version": "==3.5.0"
|
"requires_framework_version": "==3.7.0"
|
||||||
}
|
}
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import _, msgprint, throw
|
from webnotes import _, throw
|
||||||
from webnotes.utils import flt, cint, today, cstr
|
from webnotes.utils import flt, cint, today, cstr
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from setup.utils import get_company_currency
|
from setup.utils import get_company_currency
|
||||||
@ -44,14 +44,13 @@ class AccountsController(TransactionBase):
|
|||||||
def validate_for_freezed_account(self):
|
def validate_for_freezed_account(self):
|
||||||
for fieldname in ["customer", "supplier"]:
|
for fieldname in ["customer", "supplier"]:
|
||||||
if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
|
if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
|
||||||
accounts = webnotes.conn.get_values("Account", {"master_type": fieldname.title(),
|
accounts = webnotes.conn.get_values("Account",
|
||||||
"master_name": self.doc.fields[fieldname], "company": self.doc.company},
|
{"master_type": fieldname.title(), "master_name": self.doc.fields[fieldname],
|
||||||
"freeze_account", as_dict=1)
|
"company": self.doc.company}, "name")
|
||||||
|
|
||||||
if accounts:
|
if accounts:
|
||||||
if not filter(lambda x: cstr(x.freeze_account) in ["", "No"], accounts):
|
from accounts.doctype.gl_entry.gl_entry import validate_frozen_account
|
||||||
throw(_("Account for this ") + fieldname + _(" has been freezed. ") +
|
for account in accounts:
|
||||||
self.doc.doctype + _(" can not be made."))
|
validate_frozen_account(account[0])
|
||||||
|
|
||||||
def set_price_list_currency(self, buying_or_selling):
|
def set_price_list_currency(self, buying_or_selling):
|
||||||
if self.meta.get_field("currency"):
|
if self.meta.get_field("currency"):
|
||||||
|
|||||||
@ -7,7 +7,7 @@ wn.query_reports["Monthly Salary Register"] = {
|
|||||||
"fieldname":"month",
|
"fieldname":"month",
|
||||||
"label": wn._("Month"),
|
"label": wn._("Month"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
|
"options": "\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
|
||||||
"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
||||||
"Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
|
"Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -59,8 +59,8 @@ def get_columns(salary_slips):
|
|||||||
|
|
||||||
def get_salary_slips(filters):
|
def get_salary_slips(filters):
|
||||||
conditions, filters = get_conditions(filters)
|
conditions, filters = get_conditions(filters)
|
||||||
salary_slips = webnotes.conn.sql("""select * from `tabSalary Slip` where docstatus = 1 %s""" %
|
salary_slips = webnotes.conn.sql("""select * from `tabSalary Slip` where docstatus = 1 %s
|
||||||
conditions, filters, as_dict=1)
|
order by employee, month""" % conditions, filters, as_dict=1)
|
||||||
|
|
||||||
if not salary_slips:
|
if not salary_slips:
|
||||||
msgprint(_("No salary slip found for month: ") + cstr(filters.get("month")) +
|
msgprint(_("No salary slip found for month: ") + cstr(filters.get("month")) +
|
||||||
|
|||||||
@ -0,0 +1,25 @@
|
|||||||
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
import webnotes
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
webnotes.reload_doc("core", "doctype", "custom_field")
|
||||||
|
|
||||||
|
cf_doclist = webnotes.get_doctype("Custom Field")
|
||||||
|
|
||||||
|
delete_list = []
|
||||||
|
for d in webnotes.conn.sql("""select cf.name as cf_name, ps.property,
|
||||||
|
ps.value, ps.name as ps_name
|
||||||
|
from `tabProperty Setter` ps, `tabCustom Field` cf
|
||||||
|
where ps.doctype_or_field = 'DocField' and ps.property != 'previous_field'
|
||||||
|
and ps.doc_type=cf.dt and ps.field_name=cf.fieldname""", as_dict=1):
|
||||||
|
if cf_doclist.get_field(d.property):
|
||||||
|
webnotes.conn.sql("""update `tabCustom Field`
|
||||||
|
set `%s`=%s where name=%s""" % (d.property, '%s', '%s'), (d.value, d.cf_name))
|
||||||
|
|
||||||
|
delete_list.append(d.ps_name)
|
||||||
|
|
||||||
|
if delete_list:
|
||||||
|
webnotes.conn.sql("""delete from `tabProperty Setter` where name in (%s)""" %
|
||||||
|
', '.join(['%s']*len(delete_list)), tuple(delete_list))
|
||||||
@ -263,5 +263,6 @@ patch_list = [
|
|||||||
"patches.1311.p08_email_digest_recipients",
|
"patches.1311.p08_email_digest_recipients",
|
||||||
"execute:webnotes.delete_doc('DocType', 'Warehouse Type')",
|
"execute:webnotes.delete_doc('DocType', 'Warehouse Type')",
|
||||||
"patches.1312.p02_update_item_details_in_item_price",
|
"patches.1312.p02_update_item_details_in_item_price",
|
||||||
|
"patches.1401.p01_move_related_property_setters_to_custom_field",
|
||||||
"patches.1401.p01_make_buying_selling_as_check_box_in_price_list",
|
"patches.1401.p01_make_buying_selling_as_check_box_in_price_list",
|
||||||
]
|
]
|
||||||
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import _, msgprint
|
from webnotes import _, msgprint
|
||||||
|
|
||||||
from webnotes.utils import cstr
|
from webnotes.utils import cstr, cint
|
||||||
import webnotes.defaults
|
import webnotes.defaults
|
||||||
|
|
||||||
|
|
||||||
@ -237,22 +237,29 @@ class DocType:
|
|||||||
account.insert()
|
account.insert()
|
||||||
|
|
||||||
def set_default_accounts(self):
|
def set_default_accounts(self):
|
||||||
accounts = {
|
def _set_default_accounts(accounts):
|
||||||
"default_income_account": "Sales",
|
|
||||||
"default_expense_account": "Cost of Goods Sold",
|
|
||||||
"receivables_group": "Accounts Receivable",
|
|
||||||
"payables_group": "Accounts Payable",
|
|
||||||
"default_cash_account": "Cash",
|
|
||||||
"stock_received_but_not_billed": "Stock Received But Not Billed",
|
|
||||||
"stock_adjustment_account": "Stock Adjustment",
|
|
||||||
"expenses_included_in_valuation": "Expenses Included In Valuation"
|
|
||||||
}
|
|
||||||
|
|
||||||
for a in accounts:
|
for a in accounts:
|
||||||
account_name = accounts[a] + " - " + self.doc.abbr
|
account_name = accounts[a] + " - " + self.doc.abbr
|
||||||
if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
|
if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
|
||||||
webnotes.conn.set(self.doc, a, account_name)
|
webnotes.conn.set(self.doc, a, account_name)
|
||||||
|
|
||||||
|
_set_default_accounts({
|
||||||
|
"default_income_account": "Sales",
|
||||||
|
"default_expense_account": "Cost of Goods Sold",
|
||||||
|
"receivables_group": "Accounts Receivable",
|
||||||
|
"payables_group": "Accounts Payable",
|
||||||
|
"default_cash_account": "Cash"
|
||||||
|
})
|
||||||
|
|
||||||
|
if cint(webnotes.conn.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
|
||||||
|
_set_default_accounts({
|
||||||
|
"stock_received_but_not_billed": "Stock Received But Not Billed",
|
||||||
|
"stock_adjustment_account": "Stock Adjustment",
|
||||||
|
"expenses_included_in_valuation": "Expenses Included In Valuation"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def create_default_cost_center(self):
|
def create_default_cost_center(self):
|
||||||
cc_list = [
|
cc_list = [
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user