Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
742b55f700
@ -60,17 +60,6 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//get query select Territory
|
|
||||||
//=================================================================
|
|
||||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|
||||||
return{
|
|
||||||
filters:{
|
|
||||||
'is_group': "No"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------ Get Print Heading ------------------------------------
|
// ------------------ Get Print Heading ------------------------------------
|
||||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||||
return{
|
return{
|
||||||
|
@ -58,6 +58,7 @@ class DocType(BuyingController):
|
|||||||
self.check_for_acc_head_of_supplier()
|
self.check_for_acc_head_of_supplier()
|
||||||
self.check_for_stopped_status()
|
self.check_for_stopped_status()
|
||||||
self.validate_with_previous_doc()
|
self.validate_with_previous_doc()
|
||||||
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
|
|
||||||
if not self.doc.is_opening:
|
if not self.doc.is_opening:
|
||||||
self.doc.is_opening = 'No'
|
self.doc.is_opening = 'No'
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-21 16:16:39",
|
"creation": "2013-05-21 16:16:39",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-24 21:44:41",
|
"modified": "2013-07-25 16:08:44",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -69,21 +69,6 @@
|
|||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"description": "Supplier (Payable) Account",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"fieldname": "credit_to",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"in_filter": 1,
|
|
||||||
"label": "Credit To",
|
|
||||||
"oldfieldname": "credit_to",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "Account",
|
|
||||||
"print_hide": 1,
|
|
||||||
"read_only": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "supplier",
|
"fieldname": "supplier",
|
||||||
@ -675,6 +660,21 @@
|
|||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Supplier (Payable) Account",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "credit_to",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"in_filter": 1,
|
||||||
|
"label": "Credit To",
|
||||||
|
"oldfieldname": "credit_to",
|
||||||
|
"oldfieldtype": "Link",
|
||||||
|
"options": "Account",
|
||||||
|
"print_hide": 1,
|
||||||
|
"read_only": 0,
|
||||||
|
"reqd": 1,
|
||||||
|
"search_index": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"default": "No",
|
"default": "No",
|
||||||
"description": "Considered as Opening Balance",
|
"description": "Considered as Opening Balance",
|
||||||
|
@ -284,14 +284,6 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Territory
|
|
||||||
//-----------------------------
|
|
||||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|
||||||
return{
|
|
||||||
filters: {'is_group': 'NO'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Income Account in Details Table
|
// Income Account in Details Table
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
cur_frm.set_query("income_account", "entries", function(doc) {
|
cur_frm.set_query("income_account", "entries", function(doc) {
|
||||||
|
@ -60,6 +60,8 @@ class DocType(SellingController):
|
|||||||
self.so_dn_required()
|
self.so_dn_required()
|
||||||
self.validate_proj_cust()
|
self.validate_proj_cust()
|
||||||
self.validate_with_previous_doc()
|
self.validate_with_previous_doc()
|
||||||
|
self.validate_uom_is_integer("stock_uom", "qty")
|
||||||
|
|
||||||
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)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-24 19:29:05",
|
"creation": "2013-05-24 19:29:05",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-24 21:44:15",
|
"modified": "2013-07-25 16:08:10",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -61,21 +61,6 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"description": "Customer (Receivable) Account",
|
|
||||||
"doctype": "DocField",
|
|
||||||
"fieldname": "debit_to",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"in_filter": 1,
|
|
||||||
"label": "Debit To",
|
|
||||||
"oldfieldname": "debit_to",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "Account",
|
|
||||||
"print_hide": 1,
|
|
||||||
"read_only": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"search_index": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "customer",
|
"fieldname": "customer",
|
||||||
@ -821,6 +806,21 @@
|
|||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 0
|
"read_only": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Customer (Receivable) Account",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "debit_to",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"in_filter": 1,
|
||||||
|
"label": "Debit To",
|
||||||
|
"oldfieldname": "debit_to",
|
||||||
|
"oldfieldtype": "Link",
|
||||||
|
"options": "Account",
|
||||||
|
"print_hide": 1,
|
||||||
|
"read_only": 0,
|
||||||
|
"reqd": 1,
|
||||||
|
"search_index": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Track this Sales Invoice against any Project",
|
"description": "Track this Sales Invoice against any Project",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-06-04 11:02:19",
|
"creation": "2013-06-04 11:02:19",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:19",
|
"modified": "2013-07-25 16:32:10",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -107,9 +107,10 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "UOM",
|
"label": "UOM",
|
||||||
|
"options": "UOM",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,9 @@ class DocType(BuyingController):
|
|||||||
pc_obj.get_prevdoc_date(self)
|
pc_obj.get_prevdoc_date(self)
|
||||||
self.check_for_stopped_status(pc_obj)
|
self.check_for_stopped_status(pc_obj)
|
||||||
|
|
||||||
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
|
self.validate_uom_is_integer("stock_uom", ["qty", "required_qty"])
|
||||||
|
|
||||||
self.validate_with_previous_doc()
|
self.validate_with_previous_doc()
|
||||||
self.validate_for_subcontracting()
|
self.validate_for_subcontracting()
|
||||||
self.update_raw_materials_supplied("po_raw_material_details")
|
self.update_raw_materials_supplied("po_raw_material_details")
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-24 19:29:06",
|
"creation": "2013-05-24 19:29:06",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:14",
|
"modified": "2013-07-25 16:32:51",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -265,12 +265,13 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Stock UOM",
|
"label": "Stock UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"print_width": "100px",
|
"print_width": "100px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-02-22 01:27:42",
|
"creation": "2013-02-22 01:27:42",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:15",
|
"modified": "2013-07-25 16:33:05",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "dhanalekshmi@webnotestech.com"
|
"owner": "dhanalekshmi@webnotestech.com"
|
||||||
},
|
},
|
||||||
@ -111,10 +111,11 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"label": "Stock Uom",
|
"label": "Stock Uom",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-02-22 01:27:42",
|
"creation": "2013-02-22 01:27:42",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:17",
|
"modified": "2013-07-25 16:34:11",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "wasim@webnotestech.com"
|
"owner": "wasim@webnotestech.com"
|
||||||
},
|
},
|
||||||
@ -130,10 +130,11 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"label": "Stock Uom",
|
"label": "Stock Uom",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,7 @@ class DocType(BuyingController):
|
|||||||
|
|
||||||
self.validate_common()
|
self.validate_common()
|
||||||
self.validate_with_previous_doc()
|
self.validate_with_previous_doc()
|
||||||
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
purchase_controller = webnotes.get_obj("Purchase Common")
|
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||||
|
@ -20,7 +20,7 @@ from webnotes import _, msgprint
|
|||||||
from webnotes.utils import flt, cint, today, cstr
|
from webnotes.utils import flt, cint, today, cstr
|
||||||
from setup.utils import get_company_currency, get_price_list_currency
|
from setup.utils import get_company_currency, get_price_list_currency
|
||||||
from accounts.utils import get_fiscal_year, validate_fiscal_year
|
from accounts.utils import get_fiscal_year, validate_fiscal_year
|
||||||
from utilities.transaction_base import TransactionBase, validate_conversion_rate
|
from utilities.transaction_base import TransactionBase, validate_conversion_rate, validate_uom_is_integer
|
||||||
import json
|
import json
|
||||||
|
|
||||||
class AccountsController(TransactionBase):
|
class AccountsController(TransactionBase):
|
||||||
@ -28,7 +28,6 @@ class AccountsController(TransactionBase):
|
|||||||
self.set_missing_values(for_validate=True)
|
self.set_missing_values(for_validate=True)
|
||||||
|
|
||||||
self.validate_date_with_fiscal_year()
|
self.validate_date_with_fiscal_year()
|
||||||
|
|
||||||
if self.meta.get_field("currency"):
|
if self.meta.get_field("currency"):
|
||||||
self.calculate_taxes_and_totals()
|
self.calculate_taxes_and_totals()
|
||||||
self.validate_value("grand_total", ">=", 0)
|
self.validate_value("grand_total", ">=", 0)
|
||||||
|
@ -14,10 +14,46 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
wn.provide("erpnext.hr");
|
||||||
|
|
||||||
|
erpnext.hr.ExpenseClaimController = wn.ui.form.Controller.extend({
|
||||||
|
make_bank_voucher: function() {
|
||||||
|
var me = this;
|
||||||
|
wn.call({
|
||||||
|
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||||
|
args: {
|
||||||
|
"company": cur_frm.doc.company,
|
||||||
|
"voucher_type": "Bank Voucher"
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
var jv = wn.model.make_new_doc_and_get_name('Journal Voucher');
|
||||||
|
jv = locals['Journal Voucher'][jv];
|
||||||
|
jv.voucher_type = 'Bank Voucher';
|
||||||
|
jv.company = cur_frm.doc.company;
|
||||||
|
jv.remark = 'Payment against Expense Claim: ' + cur_frm.doc.name;
|
||||||
|
jv.fiscal_year = cur_frm.doc.fiscal_year;
|
||||||
|
|
||||||
|
var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
|
d1.debit = cur_frm.doc.total_sanctioned_amount;
|
||||||
|
|
||||||
|
// credit to bank
|
||||||
|
var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
|
d1.account = r.message[0].account;
|
||||||
|
d1.credit = cur_frm.doc.total_sanctioned_amount;
|
||||||
|
d1.balance = r.message[0].balance;
|
||||||
|
|
||||||
|
loaddoc('Journal Voucher', jv.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$.extend(cur_frm.cscript, new erpnext.hr.ExpenseClaimController({frm: cur_frm}));
|
||||||
|
|
||||||
cur_frm.add_fetch('employee', 'company', 'company');
|
cur_frm.add_fetch('employee', 'company', 'company');
|
||||||
cur_frm.add_fetch('employee','employee_name','employee_name');
|
cur_frm.add_fetch('employee','employee_name','employee_name');
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
cur_frm.cscript.onload = function(doc,cdt,cdn) {
|
||||||
if(!doc.approval_status)
|
if(!doc.approval_status)
|
||||||
cur_frm.set_value("approval_status", "Draft")
|
cur_frm.set_value("approval_status", "Draft")
|
||||||
|
|
||||||
@ -71,15 +107,15 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
|||||||
} else {
|
} else {
|
||||||
if(doc.approval_status=="Approved") {
|
if(doc.approval_status=="Approved") {
|
||||||
cur_frm.set_intro("Expense Claim has been approved.");
|
cur_frm.set_intro("Expense Claim has been approved.");
|
||||||
|
if(doc.docstatus==0) cur_frm.savesubmit();
|
||||||
|
if(doc.docstatus==1) cur_frm.add_custom_button("Make Bank Voucher",
|
||||||
|
cur_frm.cscript.make_bank_voucher);
|
||||||
} else if(doc.approval_status=="Rejected") {
|
} else if(doc.approval_status=="Rejected") {
|
||||||
cur_frm.set_intro("Expense Claim has been rejected.");
|
cur_frm.set_intro("Expense Claim has been rejected.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(doc.approval_status=="Approved" && doc.docstatus==0) {
|
|
||||||
cur_frm.savesubmit()
|
|
||||||
}}
|
|
||||||
|
|
||||||
cur_frm.cscript.validate = function(doc) {
|
cur_frm.cscript.validate = function(doc) {
|
||||||
cur_frm.cscript.calculate_total(doc);
|
cur_frm.cscript.calculate_total(doc);
|
||||||
|
@ -43,6 +43,10 @@ class DocType:
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
self.clear_operations()
|
self.clear_operations()
|
||||||
self.validate_main_item()
|
self.validate_main_item()
|
||||||
|
|
||||||
|
from utilities.transaction_base import validate_uom_is_integer
|
||||||
|
validate_uom_is_integer(self.doclist, "stock_uom", "qty")
|
||||||
|
|
||||||
self.validate_operations()
|
self.validate_operations()
|
||||||
self.validate_materials()
|
self.validate_materials()
|
||||||
self.set_bom_material_details()
|
self.set_bom_material_details()
|
||||||
|
@ -36,7 +36,7 @@ test_records = [
|
|||||||
"qty": 1.0,
|
"qty": 1.0,
|
||||||
"rate": 5000.0,
|
"rate": 5000.0,
|
||||||
"amount": 5000.0,
|
"amount": 5000.0,
|
||||||
"stock_uom": "No."
|
"stock_uom": "_Test UOM"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "BOM Item",
|
"doctype": "BOM Item",
|
||||||
@ -45,7 +45,7 @@ test_records = [
|
|||||||
"qty": 2.0,
|
"qty": 2.0,
|
||||||
"rate": 1000.0,
|
"rate": 1000.0,
|
||||||
"amount": 2000.0,
|
"amount": 2000.0,
|
||||||
"stock_uom": "No."
|
"stock_uom": "_Test UOM"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-02-22 01:27:49",
|
"creation": "2013-02-22 01:27:49",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-22 15:28:20",
|
"modified": "2013-07-25 16:34:42",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -75,11 +75,12 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Stock UOM",
|
"label": "Stock UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
|
@ -23,8 +23,6 @@ from webnotes import msgprint
|
|||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=[]):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
@ -58,6 +56,9 @@ class DocType:
|
|||||||
|
|
||||||
self.validate_production_order_against_so()
|
self.validate_production_order_against_so()
|
||||||
|
|
||||||
|
from utilities.transaction_base import validate_uom_is_integer
|
||||||
|
validate_uom_is_integer(self.doclist, "stock_uom", ["qty", "produced_qty"])
|
||||||
|
|
||||||
|
|
||||||
def validate_production_order_against_so(self):
|
def validate_production_order_against_so(self):
|
||||||
# already ordered qty
|
# already ordered qty
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:16",
|
"creation": "2013-01-10 16:34:16",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-11 15:51:37",
|
"modified": "2013-07-25 16:38:37",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -35,6 +35,7 @@
|
|||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
|
"role": "Manufacturing User",
|
||||||
"submit": 1,
|
"submit": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
@ -219,10 +220,11 @@
|
|||||||
"depends_on": "production_item",
|
"depends_on": "production_item",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"label": "Stock UOM",
|
"label": "Stock UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -247,15 +249,6 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm"
|
||||||
"role": "System Manager"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"role": "Manufacturing Manager"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"role": "Manufacturing User"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-02-22 01:27:49",
|
"creation": "2013-02-22 01:27:49",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:12",
|
"modified": "2013-07-25 16:35:27",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -92,11 +92,12 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "UOM",
|
"label": "UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"print_width": "80px",
|
"print_width": "80px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
|
@ -185,6 +185,9 @@ class DocType:
|
|||||||
self.validate_company()
|
self.validate_company()
|
||||||
self.validate_data()
|
self.validate_data()
|
||||||
|
|
||||||
|
from utilities.transaction_base import validate_uom_is_integer
|
||||||
|
validate_uom_is_integer(self.doclist, "stock_uom", "planned_qty")
|
||||||
|
|
||||||
items = self.get_distinct_items_and_boms()[1]
|
items = self.get_distinct_items_and_boms()[1]
|
||||||
pro = self.create_production_order(items)
|
pro = self.create_production_order(items)
|
||||||
if pro:
|
if pro:
|
||||||
|
@ -48,12 +48,6 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.frm.set_query("territory", function() {
|
|
||||||
return {
|
|
||||||
filters: {'is_group': "No" }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.frm.set_query("customer", function() {
|
this.frm.set_query("customer", function() {
|
||||||
return {
|
return {
|
||||||
query: "controllers.queries.customer_query"
|
query: "controllers.queries.customer_query"
|
||||||
|
@ -24,6 +24,7 @@ from webnotes import msgprint
|
|||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
from utilities.transaction_base import TransactionBase
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
class DocType(TransactionBase):
|
class DocType(TransactionBase):
|
||||||
def __init__(self,doc,doclist):
|
def __init__(self,doc,doclist):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
@ -138,6 +139,7 @@ class DocType(TransactionBase):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
self.set_last_contact_date()
|
self.set_last_contact_date()
|
||||||
self.validate_item_details()
|
self.validate_item_details()
|
||||||
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
self.validate_lead_cust()
|
self.validate_lead_cust()
|
||||||
|
|
||||||
from accounts.utils import validate_fiscal_year
|
from accounts.utils import validate_fiscal_year
|
||||||
|
@ -135,6 +135,9 @@ class DocType(SellingController):
|
|||||||
self.set_last_contact_date()
|
self.set_last_contact_date()
|
||||||
self.validate_order_type()
|
self.validate_order_type()
|
||||||
self.validate_for_items()
|
self.validate_for_items()
|
||||||
|
|
||||||
|
self.validate_uom_is_integer("stock_uom", "qty")
|
||||||
|
|
||||||
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')
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-03-07 11:42:57",
|
"creation": "2013-03-07 11:42:57",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:18",
|
"modified": "2013-07-25 16:35:50",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -110,11 +110,12 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "UOM",
|
"label": "UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_width": "100px",
|
"print_width": "100px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
@ -31,6 +31,9 @@ class DocType:
|
|||||||
self.check_duplicate()
|
self.check_duplicate()
|
||||||
self.validate_main_item()
|
self.validate_main_item()
|
||||||
|
|
||||||
|
from utilities.transaction_base import validate_uom_is_integer
|
||||||
|
validate_uom_is_integer(self.doclist, "uom", "qty")
|
||||||
|
|
||||||
def validate_main_item(self):
|
def validate_main_item(self):
|
||||||
"""main item must have Is Stock Item as No and Is Sales Item as Yes"""
|
"""main item must have Is Stock Item as No and Is Sales Item as Yes"""
|
||||||
if not webnotes.conn.sql("""select name from tabItem where name=%s and
|
if not webnotes.conn.sql("""select name from tabItem where name=%s and
|
||||||
|
@ -197,12 +197,6 @@ cur_frm.cscript['Unstop Sales Order'] = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|
||||||
return{
|
|
||||||
filters:{ 'is_group': "No"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||||
if(cint(wn.boot.notification_settings.sales_order)) {
|
if(cint(wn.boot.notification_settings.sales_order)) {
|
||||||
cur_frm.email_doc(wn.boot.notification_settings.sales_order_message);
|
cur_frm.email_doc(wn.boot.notification_settings.sales_order_message);
|
||||||
|
@ -139,6 +139,7 @@ class DocType(SellingController):
|
|||||||
self.validate_mandatory()
|
self.validate_mandatory()
|
||||||
self.validate_proj_cust()
|
self.validate_proj_cust()
|
||||||
self.validate_po()
|
self.validate_po()
|
||||||
|
self.validate_uom_is_integer("stock_uom", "qty")
|
||||||
|
|
||||||
if self.doc.docstatus == 1:
|
if self.doc.docstatus == 1:
|
||||||
self.validate_for_items()
|
self.validate_for_items()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-03-07 11:42:58",
|
"creation": "2013-03-07 11:42:58",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:21",
|
"modified": "2013-07-25 16:36:10",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -104,12 +104,13 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "UOM",
|
"label": "UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"print_width": "70px",
|
"print_width": "70px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:24",
|
"creation": "2013-01-10 16:34:24",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-23 12:03:54",
|
"modified": "2013-07-25 16:18:17",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -23,6 +23,7 @@
|
|||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"amend": 0,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
"parent": "UOM",
|
"parent": "UOM",
|
||||||
@ -30,7 +31,8 @@
|
|||||||
"parenttype": "DocType",
|
"parenttype": "DocType",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1
|
"report": 1,
|
||||||
|
"submit": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
@ -62,34 +64,31 @@
|
|||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
"description": "Check this to disallow fractions. (for Nos)",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "must_be_whole_number",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Must be Whole Number"
|
||||||
|
},
|
||||||
|
{
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"role": "Material Master Manager",
|
"role": "Material Master Manager",
|
||||||
"submit": 0,
|
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"create": 0,
|
"create": 0,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"role": "Material Manager",
|
"role": "Material Manager",
|
||||||
"submit": 0,
|
|
||||||
"write": 0
|
"write": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"create": 0,
|
"create": 0,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"role": "Material User",
|
"role": "Material User",
|
||||||
"submit": 0,
|
|
||||||
"write": 0
|
"write": 0
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"role": "All"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -151,12 +151,12 @@ def import_defaults():
|
|||||||
{'doctype': 'Sales Person', 'sales_person_name': 'Sales Team', 'is_group': "Yes", "parent_sales_person": ""},
|
{'doctype': 'Sales Person', 'sales_person_name': 'Sales Team', 'is_group': "Yes", "parent_sales_person": ""},
|
||||||
|
|
||||||
# UOM
|
# UOM
|
||||||
{'uom_name': 'Unit', 'doctype': 'UOM', 'name': 'Unit'},
|
{'uom_name': 'Unit', 'doctype': 'UOM', 'name': 'Unit', "must_be_whole_number": 1},
|
||||||
{'uom_name': 'Box', 'doctype': 'UOM', 'name': 'Box'},
|
{'uom_name': 'Box', 'doctype': 'UOM', 'name': 'Box', "must_be_whole_number": 1},
|
||||||
{'uom_name': 'Kg', 'doctype': 'UOM', 'name': 'Kg'},
|
{'uom_name': 'Kg', 'doctype': 'UOM', 'name': 'Kg'},
|
||||||
{'uom_name': 'Nos', 'doctype': 'UOM', 'name': 'Nos'},
|
{'uom_name': 'Nos', 'doctype': 'UOM', 'name': 'Nos', "must_be_whole_number": 1},
|
||||||
{'uom_name': 'Pair', 'doctype': 'UOM', 'name': 'Pair'},
|
{'uom_name': 'Pair', 'doctype': 'UOM', 'name': 'Pair', "must_be_whole_number": 1},
|
||||||
{'uom_name': 'Set', 'doctype': 'UOM', 'name': 'Set'},
|
{'uom_name': 'Set', 'doctype': 'UOM', 'name': 'Set', "must_be_whole_number": 1},
|
||||||
{'uom_name': 'Hour', 'doctype': 'UOM', 'name': 'Hour'},
|
{'uom_name': 'Hour', 'doctype': 'UOM', 'name': 'Hour'},
|
||||||
{'uom_name': 'Minute', 'doctype': 'UOM', 'name': 'Minute'},
|
{'uom_name': 'Minute', 'doctype': 'UOM', 'name': 'Minute'},
|
||||||
]
|
]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:25",
|
"creation": "2013-01-10 16:34:25",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 18:32:13",
|
"modified": "2013-07-25 16:36:35",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -146,11 +146,12 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"in_filter": 1,
|
"in_filter": 1,
|
||||||
"label": "UOM",
|
"label": "UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"search_index": 0
|
"search_index": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -129,14 +129,6 @@ cur_frm.cscript['Make Packing Slip'] = function() {
|
|||||||
loaddoc('Packing Slip', n);
|
loaddoc('Packing Slip', n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//get query select Territory
|
|
||||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|
||||||
return{
|
|
||||||
filters: { 'is_group': "No" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var set_print_hide= function(doc, cdt, cdn){
|
var set_print_hide= function(doc, cdt, cdn){
|
||||||
var dn_fields = wn.meta.docfield_map['Delivery Note'];
|
var dn_fields = wn.meta.docfield_map['Delivery Note'];
|
||||||
var dn_item_fields = wn.meta.docfield_map['Delivery Note Item'];
|
var dn_item_fields = wn.meta.docfield_map['Delivery Note Item'];
|
||||||
|
@ -99,6 +99,7 @@ class DocType(SellingController):
|
|||||||
sales_com_obj.get_prevdoc_date(self)
|
sales_com_obj.get_prevdoc_date(self)
|
||||||
self.validate_for_items()
|
self.validate_for_items()
|
||||||
self.validate_warehouse()
|
self.validate_warehouse()
|
||||||
|
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)
|
sales_com_obj.check_conversion_rate(self)
|
||||||
|
@ -141,7 +141,7 @@ test_records = [
|
|||||||
"export_rate": 100.0,
|
"export_rate": 100.0,
|
||||||
"amount": 500.0,
|
"amount": 500.0,
|
||||||
"warehouse": "_Test Warehouse - _TC",
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
"stock_uom": "No."
|
"stock_uom": "_Test UOM"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-04-22 13:15:44",
|
"creation": "2013-04-22 13:15:44",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:07",
|
"modified": "2013-07-25 16:37:09",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -111,11 +111,12 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "UOM",
|
"label": "UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_width": "50px",
|
"print_width": "50px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
@ -60,6 +60,7 @@ class DocType(BuyingController):
|
|||||||
super(DocType, self).validate()
|
super(DocType, self).validate()
|
||||||
|
|
||||||
self.validate_schedule_date()
|
self.validate_schedule_date()
|
||||||
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
|
|
||||||
if not self.doc.status:
|
if not self.doc.status:
|
||||||
self.doc.status = "Draft"
|
self.doc.status = "Draft"
|
||||||
|
@ -37,6 +37,10 @@ class DocType:
|
|||||||
self.validate_case_nos()
|
self.validate_case_nos()
|
||||||
self.validate_qty()
|
self.validate_qty()
|
||||||
|
|
||||||
|
from utilities.transaction_base import validate_uom_is_integer
|
||||||
|
validate_uom_is_integer(self.doclist, "stock_uom", "qty")
|
||||||
|
validate_uom_is_integer(self.doclist, "weight_uom", "net_weight")
|
||||||
|
|
||||||
def validate_delivery_note(self):
|
def validate_delivery_note(self):
|
||||||
"""
|
"""
|
||||||
Validates if delivery note has status as draft
|
Validates if delivery note has status as draft
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-04-08 13:10:16",
|
"creation": "2013-04-08 13:10:16",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:11",
|
"modified": "2013-07-25 16:37:30",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -61,9 +61,10 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "UOM",
|
"label": "UOM",
|
||||||
|
"options": "UOM",
|
||||||
"print_width": "100px",
|
"print_width": "100px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"width": "100px"
|
"width": "100px"
|
||||||
|
@ -120,7 +120,10 @@ class DocType(BuyingController):
|
|||||||
|
|
||||||
self.validate_with_previous_doc()
|
self.validate_with_previous_doc()
|
||||||
self.validate_accepted_rejected_qty()
|
self.validate_accepted_rejected_qty()
|
||||||
self.validate_inspection() # Validate Inspection
|
self.validate_inspection()
|
||||||
|
self.validate_uom_is_integer("uom", ["qty", "received_qty"])
|
||||||
|
self.validate_uom_is_integer("stock_uom", "stock_qty")
|
||||||
|
|
||||||
get_obj('Stock Ledger').validate_serial_no(self, 'purchase_receipt_details')
|
get_obj('Stock Ledger').validate_serial_no(self, 'purchase_receipt_details')
|
||||||
self.validate_challan_no()
|
self.validate_challan_no()
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-24 19:29:10",
|
"creation": "2013-05-24 19:29:10",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 14:54:16",
|
"modified": "2013-07-25 16:30:24",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -267,11 +267,12 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Stock UOM",
|
"label": "Stock UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"print_width": "100px",
|
"print_width": "100px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
@ -49,6 +49,9 @@ class DocType(StockController):
|
|||||||
get_obj('Production Order', self.doc.production_order) or None
|
get_obj('Production Order', self.doc.production_order) or None
|
||||||
|
|
||||||
self.validate_item()
|
self.validate_item()
|
||||||
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
|
self.validate_uom_is_integer("stock_uom", "transfer_qty")
|
||||||
|
|
||||||
self.validate_warehouse(pro_obj)
|
self.validate_warehouse(pro_obj)
|
||||||
self.validate_production_order(pro_obj)
|
self.validate_production_order(pro_obj)
|
||||||
self.get_stock_and_rate()
|
self.get_stock_and_rate()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-29 19:25:42",
|
"creation": "2013-01-29 19:25:42",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-10 18:34:09",
|
"modified": "2013-07-25 16:39:10",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -181,10 +181,11 @@
|
|||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "stock_uom",
|
"fieldname": "stock_uom",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Link",
|
||||||
"label": "Stock UOM",
|
"label": "Stock UOM",
|
||||||
"oldfieldname": "stock_uom",
|
"oldfieldname": "stock_uom",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
|
"options": "UOM",
|
||||||
"print_width": "150px",
|
"print_width": "150px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"width": "150px"
|
"width": "150px"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, flt, now
|
from webnotes.utils import cstr, flt, now, cint
|
||||||
from webnotes.model import db_exists
|
from webnotes.model import db_exists
|
||||||
from webnotes.model.bean import copy_doclist
|
from webnotes.model.bean import copy_doclist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
@ -25,8 +25,6 @@ from webnotes import msgprint
|
|||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl=[]):
|
def __init__(self, d, dl=[]):
|
||||||
self.doc, self.doclist = d,dl
|
self.doc, self.doclist = d,dl
|
||||||
@ -97,6 +95,7 @@ class DocType:
|
|||||||
def update_stock_uom(self):
|
def update_stock_uom(self):
|
||||||
# validate mandatory
|
# validate mandatory
|
||||||
self.validate_mandatory()
|
self.validate_mandatory()
|
||||||
|
self.validate_uom_integer_type()
|
||||||
|
|
||||||
# update item master
|
# update item master
|
||||||
self.update_item_master()
|
self.update_item_master()
|
||||||
@ -109,6 +108,19 @@ class DocType:
|
|||||||
|
|
||||||
get_obj("Item", self.doc.item_code).on_update()
|
get_obj("Item", self.doc.item_code).on_update()
|
||||||
|
|
||||||
|
def validate_uom_integer_type(self):
|
||||||
|
current_is_integer = webnotes.conn.get_value("UOM", self.doc.current_stock_uom, "must_be_whole_number")
|
||||||
|
new_is_integer = webnotes.conn.get_value("UOM", self.doc.new_stock_uom, "must_be_whole_number")
|
||||||
|
|
||||||
|
if current_is_integer and not new_is_integer:
|
||||||
|
webnotes.msgprint("New UOM must be of type Whole Number", raise_exception=True)
|
||||||
|
|
||||||
|
if not current_is_integer and new_is_integer:
|
||||||
|
webnotes.msgprint("New UOM must NOT be of type Whole Number", raise_exception=True)
|
||||||
|
|
||||||
|
if current_is_integer and new_is_integer and cint(self.doc.conversion_factor)!=self.doc.conversion_factor:
|
||||||
|
webnotes.msgprint("Conversion Factor cannot be fraction", raise_exception=True)
|
||||||
|
|
||||||
@webnotes.whitelist()
|
@webnotes.whitelist()
|
||||||
def get_stock_uom(item_code):
|
def get_stock_uom(item_code):
|
||||||
return { 'current_stock_uom': cstr(webnotes.conn.get_value('Item', item_code, 'stock_uom')) }
|
return { 'current_stock_uom': cstr(webnotes.conn.get_value('Item', item_code, 'stock_uom')) }
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:30",
|
"creation": "2013-01-10 16:34:30",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-05 14:56:45",
|
"modified": "2013-07-25 17:39:14",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -62,6 +62,12 @@
|
|||||||
"label": "New Stock UOM",
|
"label": "New Stock UOM",
|
||||||
"options": "UOM"
|
"options": "UOM"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "conversion_factor",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"label": "Conversion Factor"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "update",
|
"fieldname": "update",
|
||||||
@ -69,12 +75,6 @@
|
|||||||
"label": "Update",
|
"label": "Update",
|
||||||
"options": "update_stock_uom"
|
"options": "update_stock_uom"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"doctype": "DocField",
|
|
||||||
"fieldname": "conversion_factor",
|
|
||||||
"fieldtype": "Float",
|
|
||||||
"label": "Conversion Factor"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"role": "Material Master Manager"
|
"role": "Material Master Manager"
|
||||||
|
@ -117,11 +117,6 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
|||||||
cur_frm.add_fetch('item_code', 'item_name', 'item_name');
|
cur_frm.add_fetch('item_code', 'item_name', 'item_name');
|
||||||
cur_frm.add_fetch('item_code', 'description', 'description');
|
cur_frm.add_fetch('item_code', 'description', 'description');
|
||||||
|
|
||||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|
||||||
return{
|
|
||||||
filters:{ 'is_group': "No"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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" } }
|
||||||
|
@ -123,11 +123,5 @@ cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|
||||||
return{
|
|
||||||
filters:{ 'is_group': "No"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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" } }
|
||||||
|
@ -118,14 +118,6 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//get query select Territory
|
|
||||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|
||||||
return{
|
|
||||||
filters:{
|
|
||||||
'is_group': "No"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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" }
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import msgprint, _
|
from webnotes import msgprint, _
|
||||||
from webnotes.utils import load_json, cstr, flt, now_datetime
|
from webnotes.utils import load_json, cstr, flt, now_datetime, cint
|
||||||
from webnotes.model.doc import addchild
|
from webnotes.model.doc import addchild
|
||||||
|
|
||||||
from controllers.status_updater import StatusUpdater
|
from controllers.status_updater import StatusUpdater
|
||||||
@ -292,6 +292,9 @@ class TransactionBase(StatusUpdater):
|
|||||||
|
|
||||||
webnotes.bean(event_doclist).insert()
|
webnotes.bean(event_doclist).insert()
|
||||||
|
|
||||||
|
def validate_uom_is_integer(self, uom_field, qty_fields):
|
||||||
|
validate_uom_is_integer(self.doclist, uom_field, qty_fields)
|
||||||
|
|
||||||
def validate_with_previous_doc(self, source_dt, ref):
|
def validate_with_previous_doc(self, source_dt, ref):
|
||||||
for key, val in ref.items():
|
for key, val in ref.items():
|
||||||
is_child = val.get("is_child_table")
|
is_child = val.get("is_child_table")
|
||||||
@ -498,3 +501,23 @@ def validate_currency(args, item, meta=None):
|
|||||||
def delete_events(ref_type, ref_name):
|
def delete_events(ref_type, ref_name):
|
||||||
webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent`
|
webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent`
|
||||||
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
|
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
|
||||||
|
|
||||||
|
def validate_uom_is_integer(doclist, uom_field, qty_fields):
|
||||||
|
if isinstance(qty_fields, basestring):
|
||||||
|
qty_fields = [qty_fields]
|
||||||
|
|
||||||
|
integer_uoms = filter(lambda uom: webnotes.conn.get_value("UOM", uom,
|
||||||
|
"must_be_whole_number") or None, doclist.get_distinct_values(uom_field))
|
||||||
|
|
||||||
|
if not integer_uoms:
|
||||||
|
return
|
||||||
|
|
||||||
|
for d in doclist:
|
||||||
|
if d.fields.get(uom_field) in integer_uoms:
|
||||||
|
for f in qty_fields:
|
||||||
|
if d.fields.get(f):
|
||||||
|
if cint(d.fields[f])!=d.fields[f]:
|
||||||
|
webnotes.msgprint(_("For UOM") + " '" + d.fields[uom_field] \
|
||||||
|
+ "': " + _("Quantity cannot be a fraction.") \
|
||||||
|
+ " " + _("In Row") + ": " + str(d.idx),
|
||||||
|
raise_exception=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user