[fixes] production, added qty transferred, fix gantt, fiscal year (set fiscal year, instead of validation

This commit is contained in:
Rushabh Mehta 2015-02-19 14:51:58 +05:30
parent 3fa7cc524b
commit d60acb9f26
54 changed files with 955 additions and 867 deletions

View File

@ -1,5 +1,5 @@
{
"autoname": "CBD/.######",
"autoname": "hash",
"creation": "2013-03-07 11:55:04",
"docstatus": 0,
"doctype": "DocType",
@ -44,7 +44,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2014-05-09 02:12:39.595788",
"modified": "2015-02-19 01:06:59.471417",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Budget Detail",

View File

@ -53,7 +53,7 @@ class GLEntry(Document):
def validate_posting_date(self):
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year, "Posting Date")
validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
def check_pl_account(self):
if self.is_opening=='Yes' and \

View File

@ -1,5 +1,5 @@
{
"autoname": "JVD.######",
"autoname": "hash",
"creation": "2013-02-22 01:27:39",
"docstatus": 0,
"doctype": "DocType",
@ -206,7 +206,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2014-12-25 15:44:03.077639",
"modified": "2015-02-19 01:07:00.388689",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry Account",

View File

@ -1,5 +1,5 @@
{
"autoname": "BDD/.#####",
"autoname": "hash",
"creation": "2013-02-22 01:27:38",
"docstatus": 0,
"doctype": "DocType",
@ -27,7 +27,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2014-12-25 15:45:11.173204",
"modified": "2015-02-19 01:07:00.800015",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Monthly Distribution Percentage",

View File

@ -1,5 +1,5 @@
{
"autoname": "EVD.######",
"autoname": "hash",
"creation": "2013-05-22 12:43:10",
"docstatus": 0,
"doctype": "DocType",
@ -399,7 +399,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-01-01 14:29:58.851242",
"modified": "2015-02-19 01:07:01.060411",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",

View File

@ -1,164 +1,164 @@
{
"autoname": "PVTD.######",
"creation": "2013-05-21 16:16:04",
"docstatus": 0,
"doctype": "DocType",
"autoname": "hash",
"creation": "2013-05-21 16:16:04",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"default": "Valuation and Total",
"fieldname": "category",
"fieldtype": "Select",
"in_list_view": 0,
"label": "Consider Tax or Charge for",
"oldfieldname": "category",
"oldfieldtype": "Select",
"options": "Valuation and Total\nValuation\nTotal",
"permlevel": 0,
"read_only": 0,
"default": "Valuation and Total",
"fieldname": "category",
"fieldtype": "Select",
"in_list_view": 0,
"label": "Consider Tax or Charge for",
"oldfieldname": "category",
"oldfieldtype": "Select",
"options": "Valuation and Total\nValuation\nTotal",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
},
{
"default": "Add",
"fieldname": "add_deduct_tax",
"fieldtype": "Select",
"label": "Add or Deduct",
"oldfieldname": "add_deduct_tax",
"oldfieldtype": "Select",
"options": "Add\nDeduct",
"permlevel": 0,
"read_only": 0,
"default": "Add",
"fieldname": "add_deduct_tax",
"fieldtype": "Select",
"label": "Add or Deduct",
"oldfieldname": "add_deduct_tax",
"oldfieldtype": "Select",
"options": "Add\nDeduct",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
},
{
"fieldname": "charge_type",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Type",
"oldfieldname": "charge_type",
"oldfieldtype": "Select",
"options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total",
"permlevel": 0,
"read_only": 0,
"fieldname": "charge_type",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Type",
"oldfieldname": "charge_type",
"oldfieldtype": "Select",
"options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
},
{
"depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1",
"fieldname": "row_id",
"fieldtype": "Data",
"hidden": 0,
"label": "Reference Row #",
"oldfieldname": "row_id",
"oldfieldtype": "Data",
"permlevel": 0,
"depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1",
"fieldname": "row_id",
"fieldtype": "Data",
"hidden": 0,
"label": "Reference Row #",
"oldfieldname": "row_id",
"oldfieldtype": "Data",
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "description",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_width": "300px",
"read_only": 0,
"reqd": 1,
"fieldname": "description",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_width": "300px",
"read_only": 0,
"reqd": 1,
"width": "300px"
},
},
{
"fieldname": "col_break1",
"fieldtype": "Column Break",
"fieldname": "col_break1",
"fieldtype": "Column Break",
"permlevel": 0
},
},
{
"fieldname": "account_head",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Account Head",
"oldfieldname": "account_head",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"read_only": 0,
"fieldname": "account_head",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Account Head",
"oldfieldname": "account_head",
"oldfieldtype": "Link",
"options": "Account",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
},
{
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Cost Center",
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Cost Center",
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center",
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "rate",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Rate",
"oldfieldname": "rate",
"oldfieldtype": "Currency",
"permlevel": 0,
"read_only": 0,
"fieldname": "rate",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Rate",
"oldfieldname": "rate",
"oldfieldtype": "Currency",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
},
{
"fieldname": "tax_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount",
"oldfieldname": "tax_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"read_only": 1,
"fieldname": "tax_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount",
"oldfieldname": "tax_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"read_only": 1,
"reqd": 0
},
},
{
"fieldname": "total",
"fieldtype": "Currency",
"label": "Total",
"oldfieldname": "total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"fieldname": "total",
"fieldtype": "Currency",
"label": "Total",
"oldfieldname": "total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "item_wise_tax_detail",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Item Wise Tax Detail ",
"oldfieldname": "item_wise_tax_detail",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_hide": 1,
"fieldname": "item_wise_tax_detail",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Item Wise Tax Detail ",
"oldfieldname": "item_wise_tax_detail",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
},
{
"fieldname": "parenttype",
"fieldtype": "Data",
"hidden": 1,
"in_filter": 1,
"label": "Parenttype",
"oldfieldname": "parenttype",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"fieldname": "parenttype",
"fieldtype": "Data",
"hidden": 1,
"in_filter": 1,
"label": "Parenttype",
"oldfieldname": "parenttype",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"search_index": 0
}
],
"hide_heading": 1,
"idx": 1,
"istable": 1,
"modified": "2014-05-30 03:43:32.494112",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Taxes and Charges",
"owner": "Administrator",
],
"hide_heading": 1,
"idx": 1,
"istable": 1,
"modified": "2015-02-19 01:07:01.581115",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Taxes and Charges",
"owner": "Administrator",
"permissions": []
}
}

View File

@ -1,5 +1,5 @@
{
"autoname": "INVD.######",
"autoname": "hash",
"creation": "2013-06-04 11:02:19",
"docstatus": 0,
"doctype": "DocType",
@ -439,7 +439,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-01-01 14:29:59.027192",
"modified": "2015-02-19 01:07:01.862525",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

View File

@ -1,5 +1,5 @@
{
"autoname": "INVTD.######",
"autoname": "hash",
"creation": "2013-04-24 11:39:32",
"docstatus": 0,
"doctype": "DocType",
@ -147,7 +147,7 @@
"hide_heading": 1,
"idx": 1,
"istable": 1,
"modified": "2014-12-10 12:26:41.222471",
"modified": "2015-02-19 01:07:02.165094",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Taxes and Charges",

View File

@ -41,10 +41,13 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb
raise FiscalYearError, error_msg
return fy
def validate_fiscal_year(date, fiscal_year, label="Date"):
def validate_fiscal_year(date, fiscal_year, label=_("Date"), doc=None):
years = [f[0] for f in get_fiscal_years(date, label=label)]
if fiscal_year not in years:
throw(_("{0} '{1}' not in Fiscal Year {2}").format(label, formatdate(date), fiscal_year))
if doc:
doc.fiscal_year = years[0]
else:
throw(_("{0} '{1}' not in Fiscal Year {2}").format(label, formatdate(date), fiscal_year))
@frappe.whitelist()
def get_balance_on(account=None, date=None, party_type=None, party=None):

View File

@ -1,5 +1,5 @@
{
"autoname": "POD/.#####",
"autoname": "hash",
"creation": "2013-05-24 19:29:06",
"docstatus": 0,
"doctype": "DocType",
@ -484,7 +484,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-12 15:11:13.784588",
"modified": "2015-02-19 01:07:01.224244",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",

View File

@ -1,6 +1,6 @@
{
"autoname": "QASD/.#####",
"creation": "2013-02-22 01:27:43.000000",
"autoname": "hash",
"creation": "2013-02-22 01:27:43",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -120,9 +120,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-20 19:23:39.000000",
"modified": "2015-02-19 01:07:01.658125",
"modified_by": "Administrator",
"module": "Buying",
"name": "Quality Inspection Reading",
"owner": "Administrator"
"owner": "Administrator",
"permissions": []
}

View File

@ -1,5 +1,5 @@
{
"autoname": "SQI-.#####",
"autoname": "hash",
"creation": "2013-05-22 12:43:10",
"docstatus": 0,
"doctype": "DocType",
@ -360,7 +360,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-12 15:16:13.616428",
"modified": "2015-02-19 01:07:02.403267",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Item",

View File

@ -69,7 +69,7 @@ class AccountsController(TransactionBase):
if date_field and self.get(date_field):
validate_fiscal_year(self.get(date_field), self.fiscal_year,
label=self.meta.get_label(date_field))
self.meta.get_label(date_field), self)
def validate_due_date(self):
from erpnext.accounts.party import validate_due_date

View File

@ -29,7 +29,7 @@ class Opportunity(TransactionBase):
self.validate_cust_name()
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.transaction_date, self.fiscal_year, "Opportunity Date")
validate_fiscal_year(self.transaction_date, self.fiscal_year, _("Opportunity Date"), self)
def on_submit(self):
if self.lead:
@ -52,11 +52,11 @@ class Opportunity(TransactionBase):
def has_quotation(self):
return frappe.db.get_value("Quotation Item", {"prevdoc_docname": self.name, "docstatus": 1})
def has_ordered_quotation(self):
return frappe.db.sql("""select q.name from `tabQuotation` q, `tabQuotation Item` qi
return frappe.db.sql("""select q.name from `tabQuotation` q, `tabQuotation Item` qi
where q.name = qi.parent and q.docstatus=1 and qi.prevdoc_docname =%s and q.status = 'Ordered'""", self.name)
def validate_cust_name(self):
self.customer_name = self.customer or self.lead

View File

@ -1,6 +1,6 @@
{
"autoname": "APRSLD.#####",
"creation": "2013-02-22 01:27:44.000000",
"autoname": "hash",
"creation": "2013-02-22 01:27:44",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -59,9 +59,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-20 19:22:53.000000",
"modified": "2015-02-19 01:06:59.212681",
"modified_by": "Administrator",
"module": "HR",
"name": "Appraisal Goal",
"owner": "ashwini@webnotestech.com"
"owner": "ashwini@webnotestech.com",
"permissions": []
}

View File

@ -1,6 +1,6 @@
{
"autoname": "KSHEET.#####",
"creation": "2013-02-22 01:27:44.000000",
"autoname": "hash",
"creation": "2013-02-22 01:27:44",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -32,9 +32,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-20 19:22:54.000000",
"modified": "2015-02-19 01:06:59.356774",
"modified_by": "Administrator",
"module": "HR",
"name": "Appraisal Template Goal",
"owner": "ashwini@webnotestech.com"
"owner": "ashwini@webnotestech.com",
"permissions": []
}

View File

@ -29,10 +29,6 @@ class Attendance(Document):
frappe.throw(_("Employee {0} was on leave on {1}. Cannot mark attendance.").format(self.employee,
self.att_date))
def validate_fiscal_year(self):
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.att_date, self.fiscal_year)
def validate_att_date(self):
if getdate(self.att_date) > getdate(nowdate()):
frappe.throw(_("Attendance can not be marked for future dates"))
@ -45,8 +41,9 @@ class Attendance(Document):
def validate(self):
from erpnext.utilities import validate_status
from erpnext.accounts.utils import validate_fiscal_year
validate_status(self.status, ["Present", "Absent", "Half Day"])
self.validate_fiscal_year()
validate_fiscal_year(self.att_date, self.fiscal_year, _("Attendance Date"), self)
self.validate_att_date()
self.validate_duplicate_record()
self.check_leave_record()

View File

@ -1,6 +1,6 @@
{
"allow_import": 0,
"autoname": "LAPPR-/.#####",
"autoname": "hash",
"creation": "2013-04-12 06:56:15",
"description": "Users who can approve a specific employee's leave applications",
"docstatus": 0,
@ -21,7 +21,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2014-08-27 06:21:36.887205",
"modified": "2015-02-19 01:07:00.128600",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Leave Approver",

View File

@ -7,6 +7,7 @@ from frappe import _
from frappe.utils import get_fullname
from frappe.model.document import Document
from erpnext.hr.utils import set_employee_name
from erpnext.accounts.utils import validate_fiscal_year
class InvalidExpenseApproverError(frappe.ValidationError): pass
@ -16,7 +17,7 @@ class ExpenseClaim(Document):
self.employee_name, self.total_claimed_amount)
def validate(self):
self.validate_fiscal_year()
validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
self.validate_exp_details()
self.validate_expense_approver()
set_employee_name(self)
@ -25,10 +26,6 @@ class ExpenseClaim(Document):
if self.approval_status=="Draft":
frappe.throw(_("""Approval Status must be 'Approved' or 'Rejected'"""))
def validate_fiscal_year(self):
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year, "Posting Date")
def validate_exp_details(self):
if not self.get('expenses'):
frappe.throw(_("Please add expense voucher details"))

View File

@ -11,41 +11,41 @@ from frappe import _
from frappe.model.document import Document
class LeaveBlockList(Document):
def validate(self):
dates = []
for d in self.get("leave_block_list_dates"):
# validate fiscal year
validate_fiscal_year(d.block_date, self.year, _("Block Date"))
# date is not repeated
if d.block_date in dates:
frappe.msgprint(_("Date is repeated") + ":" + d.block_date, raise_exception=1)
dates.append(d.block_date)
@frappe.whitelist()
def get_applicable_block_dates(from_date, to_date, employee=None,
def get_applicable_block_dates(from_date, to_date, employee=None,
company=None, all_lists=False):
block_dates = []
for block_list in get_applicable_block_lists(employee, company, all_lists):
block_dates.extend(frappe.db.sql("""select block_date, reason
from `tabLeave Block List Date` where parent=%s
and block_date between %s and %s""", (block_list, from_date, to_date),
block_dates.extend(frappe.db.sql("""select block_date, reason
from `tabLeave Block List Date` where parent=%s
and block_date between %s and %s""", (block_list, from_date, to_date),
as_dict=1))
return block_dates
def get_applicable_block_lists(employee=None, company=None, all_lists=False):
block_lists = []
if not employee:
employee = frappe.db.get_value("Employee", {"user_id":frappe.session.user})
if not employee:
return []
if not company:
company = frappe.db.get_value("Employee", employee, "company")
def add_block_list(block_list):
if block_list:
if all_lists or not is_user_in_allow_list(block_list):
@ -61,9 +61,9 @@ def get_applicable_block_lists(employee=None, company=None, all_lists=False):
for block_list in frappe.db.sql_list("""select name from `tabLeave Block List`
where ifnull(applies_to_all_departments,0)=1 and company=%s""", company):
add_block_list(block_list)
return list(set(block_lists))
def is_user_in_allow_list(block_list):
return frappe.session.user in frappe.db.sql_list("""select allow_user
from `tabLeave Block List Allow` where parent=%s""", block_list)
from `tabLeave Block List Allow` where parent=%s""", block_list)

View File

@ -164,6 +164,8 @@ cur_frm.cscript.validate = function(doc, dt, dn) {
frappe.ui.form.on("BOM Operation", "operation", function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
if(!d.operation) return;
frappe.call({
"method": "frappe.client.get",
args: {
@ -206,4 +208,4 @@ frappe.ui.form.on("BOM Item", "items_remove", function(frm) {
cur_frm.cscript.image = function() {
refresh_field("image_view");
}
}

View File

@ -14,10 +14,9 @@ class BOM(Document):
def autoname(self):
last_name = frappe.db.sql("""select max(name) from `tabBOM`
where name like "BOM/%s/%%" """ % cstr(self.item).replace('"', '\\"'))
where name like "BOM/%s/%%" """ % frappe.db.escape(self.item))
if last_name:
idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1
else:
idx = 1
self.name = 'BOM/' + self.item + ('/%.3i' % idx)

View File

@ -1,5 +1,5 @@
{
"autoname": "FBD/.######",
"autoname": "hash",
"creation": "2013-03-07 11:42:57",
"default_print_format": "Standard",
"docstatus": 0,
@ -140,7 +140,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-12 15:16:56.092124",
"modified": "2015-02-19 01:06:59.399382",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Explosion Item",

View File

@ -1,41 +1,142 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, {
onload: function (doc, dt, dn) {
if (!doc.status) doc.status = 'Draft';
cfn_set_fields(doc, dt, dn);
frappe.ui.form.on("Production Order", "onload", function(frm) {
if (!frm.doc.status)
frm.doc.status = 'Draft';
this.frm.add_fetch("sales_order", "delivery_date", "expected_delivery_date");
frm.add_fetch("sales_order", "delivery_date", "expected_delivery_date");
if(doc.__islocal) {
cur_frm.set_value({
if(frm.doc.__islocal) {
frm.set_value({
"actual_start_date": "",
"actual_end_date": ""
});
});
}
erpnext.production_order.set_custom_buttons(frm);
erpnext.production_order.setup_company_filter(frm);
erpnext.production_order.setup_bom_filter(frm);
});
frappe.ui.form.on("Production Order", "refresh", function(frm) {
erpnext.toggle_naming_series();
frm.set_intro("");
erpnext.production_order.set_custom_buttons(frm);
if (frm.doc.docstatus === 0 && !frm.doc.__islocal) {
frm.set_intro(__("Submit this Production Order for further processing."));
}
});
frappe.ui.form.on("Production Order", "additional_operating_cost", function(frm) {
erpnext.production_order.calculate_total_cost(frm);
});
frappe.ui.form.on("Production Order Operation", "workstation", function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.call({
"method": "frappe.client.get",
args: {
doctype: "Workstation",
name: d.workstation
},
callback: function (data) {
frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate);
erpnext.production_order.calculate_cost(frm.doc);
erpnext.production_order.calculate_total_cost(frm);
}
},
})
});
before_submit: function() {
cur_frm.toggle_reqd(["fg_warehouse", "wip_warehouse"], true);
},
frappe.ui.form.on("Production Order Operation", "time_in_mins", function(frm, cdt, cdn) {
erpnext.production_order.calculate_cost(frm.doc);
erpnext.production_order.calculate_total_cost(frm)
});
refresh: function(doc, dt, dn) {
this.frm.dashboard.reset();
erpnext.toggle_naming_series();
this.frm.set_intro("");
cfn_set_fields(doc, dt, dn);
erpnext.production_order = {
set_custom_buttons: function(frm) {
var doc = frm.doc;
if (doc.docstatus === 1) {
if (doc.docstatus === 0 && !doc.__islocal) {
this.frm.set_intro(__("Submit this Production Order for further processing."));
} else if (doc.docstatus === 1) {
var percent = flt(doc.produced_qty) / flt(doc.qty) * 100;
this.frm.dashboard.add_progress(cint(percent) + "% " + __("Complete"), percent);
if (doc.material_transferred_for_qty < doc.qty) {
frm.add_custom_button(__('Transfer Materials for Manufacture'),
cur_frm.cscript['Transfer Raw Materials'], frappe.boot.doctype_icons["Stock Entry"]);
}
if(doc.status === "Stopped") {
this.frm.dashboard.set_headline_alert(__("Stopped"), "alert-danger", "icon-stop");
if (doc.produced_qty < doc.material_transferred_for_qty) {
frm.add_custom_button(__('Update Finished Goods'),
cur_frm.cscript['Update Finished Goods'], frappe.boot.doctype_icons["Stock Entry"]);
}
if(doc.status==="Completed") {
frm.add_custom_button(__("Show Stock Entries"), function() {
frappe.route_options = {
production_order: frm.doc.name
}
frappe.set_route("List", "Stock Entry");
});
}
if (doc.status != 'Stopped' && doc.status != 'Completed') {
frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Production Order'],
"icon-exclamation", "btn-default");
} else if (doc.status == 'Stopped') {
frm.add_custom_button(__('Unstop'), cur_frm.cscript['Unstop Production Order'],
"icon-check", "btn-default");
}
}
},
calculate_cost: function(doc) {
if (doc.operations){
var op = doc.operations;
doc.planned_operating_cost = 0.0;
for(var i=0;i<op.length;i++) {
planned_operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
frappe.model.set_value('Production Order Operation',op[i].name, "planned_operating_cost", planned_operating_cost);
doc.planned_operating_cost += planned_operating_cost;
}
refresh_field('planned_operating_cost');
}
},
calculate_total_cost: function(frm) {
var variable_cost = frm.doc.actual_operating_cost ?
flt(frm.doc.actual_operating_cost) : flt(frm.doc.planned_operating_cost)
frm.set_value("total_operating_cost", (flt(frm.doc.additional_operating_cost) + variable_cost))
},
setup_company_filter: function(frm) {
var company_filter = function(doc) {
return {
filters: {
'company': frm.doc.company
}
}
}
frm.fields_dict.fg_warehouse.get_query = company_filter;
frm.fields_dict.wip_warehouse.get_query = company_filter;
},
setup_bom_filter: function(frm) {
frm.set_query("bom_no", function(doc) {
if (doc.production_item) {
return{
query: "erpnext.controllers.queries.bom",
filters: {item: cstr(doc.production_item)}
}
} else msgprint(__("Please enter Production Item first"));
});
}
}
$.extend(cur_frm.cscript, {
before_submit: function() {
cur_frm.toggle_reqd(["fg_warehouse", "wip_warehouse"], true);
},
production_item: function(doc) {
@ -105,29 +206,9 @@ $.extend(cur_frm.cscript, {
"production_order_id": doc.name
}
});
}
},
});
var cfn_set_fields = function(doc, dt, dn) {
if (doc.docstatus == 1) {
if (doc.status == 'Submitted' || doc.status == 'Material Transferred' || doc.status == 'In Process'){
cur_frm.add_custom_button(__('Transfer Raw Materials'),
cur_frm.cscript['Transfer Raw Materials'], frappe.boot.doctype_icons["Stock Entry"]);
cur_frm.add_custom_button(__('Update Finished Goods'),
cur_frm.cscript['Update Finished Goods'], frappe.boot.doctype_icons["Stock Entry"]);
}
if (doc.status != 'Stopped' && doc.status != 'Completed') {
cur_frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Production Order'],
"icon-exclamation", "btn-default");
} else if (doc.status == 'Stopped') {
cur_frm.add_custom_button(__('Unstop'), cur_frm.cscript['Unstop Production Order'],
"icon-check", "btn-default");
}
}
}
cur_frm.cscript['Stop Production Order'] = function() {
var doc = cur_frm.doc;
var check = confirm(__("Do you really want to stop production order: " + doc.name));
@ -167,67 +248,6 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
}
}
cur_frm.set_query("bom_no", function(doc) {
if (doc.production_item) {
return{
query: "erpnext.controllers.queries.bom",
filters: {item: cstr(doc.production_item)}
}
} else msgprint(__("Please enter Production Item first"));
});
var calculate_total_cost = function(frm) {
var variable_cost = frm.doc.actual_operating_cost ? flt(frm.doc.actual_operating_cost) : flt(frm.doc.planned_operating_cost)
frm.set_value("total_operating_cost", (flt(frm.doc.additional_operating_cost) + variable_cost))
}
frappe.ui.form.on("Production Order", "additional_operating_cost", function(frm) {
calculate_total_cost(frm);
});
frappe.ui.form.on("Production Order Operation", "workstation", function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.call({
"method": "frappe.client.get",
args: {
doctype: "Workstation",
name: d.workstation
},
callback: function (data) {
frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate);
calculate_cost(frm.doc);
calculate_total_cost(frm);
}
})
});
var calculate_cost = function(doc) {
if (doc.operations){
var op = doc.operations;
doc.planned_operating_cost = 0.0;
for(var i=0;i<op.length;i++) {
planned_operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
frappe.model.set_value('Production Order Operation',op[i].name, "planned_operating_cost", planned_operating_cost);
doc.planned_operating_cost += planned_operating_cost;
}
refresh_field('planned_operating_cost');
}
}
frappe.ui.form.on("Production Order Operation", "time_in_mins", function(frm, cdt, cdn) {
calculate_cost(frm.doc);
calculate_total_cost(frm)
});
var company_filter = function(doc) {
return{
filters: {
'company': doc.company
}
}
}
cur_frm.fields_dict.fg_warehouse.get_query = company_filter
cur_frm.fields_dict.wip_warehouse.get_query = company_filter

View File

@ -65,6 +65,14 @@
"read_only": 0,
"reqd": 1
},
{
"default": "1",
"description": "Plan material for sub-assemblies",
"fieldname": "use_multi_level_bom",
"fieldtype": "Check",
"label": "Use Multi-Level BOM",
"permlevel": 0
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
@ -85,6 +93,15 @@
"read_only": 0,
"reqd": 1
},
{
"description": "Automatically updated via Stock Entry",
"fieldname": "material_transferred_for_qty",
"fieldtype": "Int",
"label": "Material Transferred for Qty",
"permlevel": 0,
"precision": "",
"read_only": 1
},
{
"default": "0",
"depends_on": "eval:doc.docstatus==1",
@ -99,13 +116,37 @@
"read_only": 1
},
{
"default": "1",
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
"fieldname": "use_multi_level_bom",
"fieldtype": "Check",
"label": "Use Multi-Level BOM",
"fieldname": "warehouses",
"fieldtype": "Section Break",
"label": "Warehouses",
"options": "icon-building",
"permlevel": 0
},
{
"fieldname": "wip_warehouse",
"fieldtype": "Link",
"label": "Work-in-Progress Warehouse",
"options": "Warehouse",
"permlevel": 0,
"reqd": 0
},
{
"fieldname": "column_break_12",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"depends_on": "",
"description": "",
"fieldname": "fg_warehouse",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Target Warehouse",
"options": "Warehouse",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "time",
"fieldtype": "Section Break",
@ -158,38 +199,6 @@
"precision": "",
"read_only": 1
},
{
"fieldname": "warehouses",
"fieldtype": "Section Break",
"label": "Warehouses",
"options": "icon-building",
"permlevel": 0
},
{
"depends_on": "",
"description": "Manufactured quantity will be updated in this warehouse",
"fieldname": "fg_warehouse",
"fieldtype": "Link",
"in_list_view": 0,
"label": "For Warehouse",
"options": "Warehouse",
"permlevel": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "column_break_12",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"fieldname": "wip_warehouse",
"fieldtype": "Link",
"label": "Work-in-Progress Warehouse",
"options": "Warehouse",
"permlevel": 0,
"reqd": 0
},
{
"depends_on": "",
"fieldname": "operations_section",
@ -351,7 +360,7 @@
"idx": 1,
"in_create": 0,
"is_submittable": 1,
"modified": "2015-02-05 05:11:42.851377",
"modified": "2015-02-19 03:58:23.460022",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order",

View File

@ -120,16 +120,20 @@ class ProductionOrder(Document):
if status != self.status:
self.db_set("status", status)
def update_produced_qty(self):
produced_qty = frappe.db.sql("""select sum(fg_completed_qty)
from `tabStock Entry` where production_order=%s and docstatus=1
and purpose='Manufacture'""", self.name)
produced_qty = flt(produced_qty[0][0]) if produced_qty else 0
def update_production_order_qty(self):
"""Update **Manufactured Qty** and **Material Transferred for Qty** in Production Order
based on Stock Entry"""
for status, fieldname in (("Manufacture", "produced_qty"),
("Material Transfer for Manufacture", "material_transferred_for_qty")):
qty = flt(frappe.db.sql("""select sum(fg_completed_qty)
from `tabStock Entry` where production_order=%s and docstatus=1
and purpose=%s""", (self.name, status))[0][0])
if produced_qty > self.qty:
frappe.throw(_("Manufactured quantity {0} cannot be greater than planned quanitity {1} in Production Order {2}").format(produced_qty, self.qty, self.name), StockOverProductionError)
if qty > self.qty:
frappe.throw(_("{0} ({1}) cannot be greater than planned quanitity ({2}) in Production Order {3}").format(\
self.meta.get_label(fieldname), qty, self.qty, self.name), StockOverProductionError)
self.db_set("produced_qty", produced_qty)
self.db_set(fieldname, qty)
def on_submit(self):
if not self.wip_warehouse:
@ -223,10 +227,6 @@ class ProductionOrder(Document):
def validate_delivery_date(self):
if self.docstatus==1:
if self.planned_start_date and self.expected_delivery_date \
and getdate(self.expected_delivery_date) < getdate(self.planned_start_date):
frappe.throw(_("Expected Delivery Date cannot be greater than Planned Start Date"))
if self.planned_end_date and self.expected_delivery_date \
and getdate(self.expected_delivery_date) < getdate(self.planned_end_date):
frappe.msgprint(_("Production might not be able to finish by the Expected Delivery Date."))
@ -280,12 +280,12 @@ def get_events(start, end, filters=None):
if filters[key]:
conditions += " and " + key + ' = "' + filters[key].replace('"', '\"') + '"'
data = frappe.db.sql("""select name,production_item, production_start_date, production_end_date
data = frappe.db.sql("""select name, production_item, planned_start_date, planned_end_date
from `tabProduction Order`
where ((ifnull(production_start_date, '0000-00-00')!= '0000-00-00') \
and (production_start_date between %(start)s and %(end)s) \
or ((ifnull(production_start_date, '0000-00-00')!= '0000-00-00') \
and production_end_date between %(start)s and %(end)s)) {conditions}
where ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
and (planned_start_date between %(start)s and %(end)s) \
or ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
and planned_end_date between %(start)s and %(end)s)) {conditions}
""".format(conditions=conditions), {
"start": start,
"end": end

View File

@ -3,10 +3,10 @@
frappe.views.calendar["Production Order"] = {
field_map: {
"start": "production_start_date",
"end": "production_end_date",
"start": "planned_start_date",
"end": "planned_end_date",
"id": "name",
"title": "production_item",
"title": "name",
"allDay": "allDay"
},
gantt: true,

View File

@ -1,15 +1,18 @@
frappe.listview_settings['Production Order'] = {
add_fields: ["bom_no", "status", "sales_order", "qty",
"produced_qty", "expected_delivery_date"],
filters: [["status", "!=", "Completed"], ["status", "!=", "Stopped"]],
filters: [["status", "!=", "Stopped"]],
get_indicator: function(doc) {
return [__(doc.status), {
"Draft": "red",
"Submitted": "blue",
"Stopped": "red",
"In Process": "orange",
"Completed": "green",
"Cancelled": "darkgrey"
}[doc.status], "status,=," + doc.status];
if(doc.status==="Submitted") {
return [__("Not Started"), "orange", "status,=,Submitted"];
} else {
return [__(doc.status), {
"Draft": "red",
"Stopped": "red",
"In Process": "orange",
"Completed": "green",
"Cancelled": "darkgrey"
}[doc.status], "status,=," + doc.status];
}
}
};

View File

@ -1,6 +1,6 @@
{
"autoname": "PPID/.#####",
"creation": "2013-02-22 01:27:49.000000",
"autoname": "hash",
"creation": "2013-02-22 01:27:49",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -104,9 +104,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-20 19:23:25.000000",
"modified": "2015-02-19 01:07:00.936590",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan Item",
"owner": "Administrator"
"owner": "Administrator",
"permissions": []
}

View File

@ -1,5 +1,5 @@
{
"autoname": "PP/.SO/.#####",
"autoname": "hash",
"creation": "2013-02-22 01:27:49",
"docstatus": 0,
"doctype": "DocType",
@ -59,7 +59,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-17 14:29:14.479541",
"modified": "2015-02-19 01:07:00.991795",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan Sales Order",

View File

@ -118,3 +118,4 @@ erpnext.patches.v5_0.rename_customer_issue
erpnext.patches.v5_0.update_material_transfer_for_manufacture
erpnext.patches.v5_0.manufacturing_activity_type
erpnext.patches.v5_0.update_item_description_and_image
erpnext.patches.v5_0.update_material_transferred_for_qty

View File

@ -21,4 +21,3 @@ def add_crm_to_user_desktop_items():
user_desktop_items.append("CRM")
frappe.db.set_default(key, json.dumps(user_desktop_items), parent=user)

View File

@ -0,0 +1,9 @@
import frappe
def execute():
frappe.reload_doctype("Production Order")
frappe.db.sql("""update `tabProduction Order` set material_transferred_for_qty=
(select sum(fg_completed_qty) from `tabStock Entry`
where docstatus=1
and production_order=`tabProduction Order`.name
and purpose = "Material Transfer for Manufacture")""")

View File

@ -22,6 +22,12 @@ frappe.ui.form.on("Time Log", "hours", function(frm) {
frm._setting_hours = false;
});
// clear production order if making time log
frappe.ui.form.on("Time Log", "before_save", function(frm) {
frm.doc.production_order && frappe.model.remove_from_locals("Production Order",
frm.doc.production_order);
});
// set hours if to_time is updated
frappe.ui.form.on("Time Log", "to_time", function(frm) {
if(frm._setting_hours) return;
@ -69,7 +75,7 @@ $.extend(cur_frm.cscript, {
}
});
},
time_log_for: function(doc) {
if (doc.time_log_for == 'Manufacturing') {
cur_frm.set_value("activity_type", "Manufacturing")

View File

@ -16,15 +16,6 @@
"read_only": 0,
"reqd": 1
},
{
"fieldname": "time_log_for",
"fieldtype": "Select",
"label": "Time Log For",
"options": "\nProject\nManufacturing",
"permlevel": 0,
"precision": "",
"reqd": 0
},
{
"fieldname": "from_time",
"fieldtype": "Datetime",
@ -51,6 +42,14 @@
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "billable",
"fieldtype": "Check",
"in_list_view": 0,
"label": "Billable",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "column_break_3",
"fieldtype": "Column Break",
@ -67,6 +66,15 @@
"read_only": 1,
"reqd": 0
},
{
"fieldname": "time_log_for",
"fieldtype": "Select",
"label": "Time Log For",
"options": "\nProject\nManufacturing",
"permlevel": 0,
"precision": "",
"reqd": 0
},
{
"depends_on": "",
"fieldname": "activity_type",
@ -87,6 +95,13 @@
"permlevel": 0,
"read_only": 0
},
{
"depends_on": "eval:doc.time_log_for == 'Manufacturing'",
"fieldname": "section_break_11",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
{
"depends_on": "eval:doc.time_log_for == 'Manufacturing'",
"fieldname": "production_order",
@ -105,6 +120,12 @@
"permlevel": 0,
"precision": ""
},
{
"fieldname": "column_break_14",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{
"depends_on": "eval:doc.time_log_for == 'Manufacturing'",
"fieldname": "workstation",
@ -116,6 +137,7 @@
"read_only": 1
},
{
"depends_on": "eval:doc.time_log_for == 'Manufacturing'",
"description": "Operation completed for how many finished goods?",
"fieldname": "completed_qty",
"fieldtype": "Float",
@ -123,14 +145,6 @@
"permlevel": 0,
"precision": ""
},
{
"fieldname": "billable",
"fieldtype": "Check",
"in_list_view": 0,
"label": "Billable",
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "section_break_7",
"fieldtype": "Section Break",
@ -199,7 +213,7 @@
"icon": "icon-time",
"idx": 1,
"is_submittable": 1,
"modified": "2015-02-05 05:11:48.252723",
"modified": "2015-02-19 04:16:33.756377",
"modified_by": "Administrator",
"module": "Projects",
"name": "Time Log",

View File

@ -10,6 +10,7 @@ from frappe import _
from erpnext.stock.utils import get_valid_serial_nos
from erpnext.utilities.transaction_base import TransactionBase
from erpnext.accounts.utils import validate_fiscal_year
class InstallationNote(TransactionBase):
def __init__(self, arg1, arg2=None):
@ -30,17 +31,13 @@ class InstallationNote(TransactionBase):
}]
def validate(self):
self.validate_fiscal_year()
validate_fiscal_year(self.inst_date, self.fiscal_year, _("Installation Date"), self)
self.validate_installation_date()
self.check_item_table()
from erpnext.controllers.selling_controller import check_active_sales_items
check_active_sales_items(self)
def validate_fiscal_year(self):
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.inst_date, self.fiscal_year, "Installation Date")
def is_serial_no_added(self, item_code, serial_no):
ar_required = frappe.db.get_value("Item", item_code, "has_serial_no")
if ar_required == 'Yes' and not serial_no:

View File

@ -1,6 +1,6 @@
{
"autoname": "IID/.#####",
"creation": "2013-02-22 01:27:51.000000",
"autoname": "hash",
"creation": "2013-02-22 01:27:51",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -100,9 +100,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-20 19:23:14.000000",
"modified": "2015-02-19 01:07:00.200686",
"modified_by": "Administrator",
"module": "Selling",
"name": "Installation Note Item",
"owner": "Administrator"
"owner": "Administrator",
"permissions": []
}

View File

@ -1,5 +1,5 @@
{
"autoname": "QUOD/.#####",
"autoname": "hash",
"creation": "2013-03-07 11:42:57",
"docstatus": 0,
"doctype": "DocType",
@ -349,7 +349,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-12 15:18:41.236797",
"modified": "2015-02-19 01:07:01.742936",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Item",

View File

@ -1,455 +1,455 @@
{
"autoname": "SOD/.#####",
"creation": "2013-03-07 11:42:58",
"docstatus": 0,
"doctype": "DocType",
"autoname": "hash",
"creation": "2013-03-07 11:42:58",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
"options": "Item",
"permlevel": 0,
"print_width": "150px",
"read_only": 0,
"reqd": 1,
"search_index": 1,
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
"options": "Item",
"permlevel": 0,
"print_width": "150px",
"read_only": 0,
"reqd": 1,
"search_index": 1,
"width": "150px"
},
},
{
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
"label": "Customer's Item Code",
"permlevel": 0,
"print_hide": 1,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
"label": "Customer's Item Code",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
},
{
"fieldname": "col_break1",
"fieldtype": "Column Break",
"fieldname": "col_break1",
"fieldtype": "Column Break",
"permlevel": 0
},
},
{
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Item Name",
"oldfieldname": "item_name",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 1,
"print_width": "150",
"read_only": 0,
"reqd": 1,
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Item Name",
"oldfieldname": "item_name",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 1,
"print_width": "150",
"read_only": 0,
"reqd": 1,
"width": "150"
},
},
{
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"permlevel": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
},
{
"fieldname": "description",
"fieldtype": "Small Text",
"in_filter": 1,
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_width": "300px",
"read_only": 0,
"reqd": 1,
"search_index": 1,
"fieldname": "description",
"fieldtype": "Small Text",
"in_filter": 1,
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_width": "300px",
"read_only": 0,
"reqd": 1,
"search_index": 1,
"width": "300px"
},
},
{
"fieldname": "column_break_7",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break_7",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
},
{
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
"label": "Image",
"permlevel": 0,
"precision": "",
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
"label": "Image",
"permlevel": 0,
"precision": "",
"print_hide": 1
},
},
{
"fieldname": "image_view",
"fieldtype": "Image",
"label": "Image View",
"options": "image",
"permlevel": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"label": "Image View",
"options": "image",
"permlevel": 0,
"precision": ""
},
},
{
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"label": "Quantity and Rate",
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"label": "Quantity and Rate",
"permlevel": 0
},
},
{
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Quantity",
"oldfieldname": "qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_width": "100px",
"read_only": 0,
"reqd": 1,
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Quantity",
"oldfieldname": "qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_width": "100px",
"read_only": 0,
"reqd": 1,
"width": "100px"
},
},
{
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"label": "Price List Rate",
"oldfieldname": "ref_rate",
"oldfieldtype": "Currency",
"options": "currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "70px",
"read_only": 1,
"reqd": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"label": "Price List Rate",
"oldfieldname": "ref_rate",
"oldfieldtype": "Currency",
"options": "currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "70px",
"read_only": 1,
"reqd": 0,
"width": "70px"
},
},
{
"fieldname": "discount_percentage",
"fieldtype": "Percent",
"in_list_view": 1,
"label": "Discount(%)",
"oldfieldname": "adj_rate",
"oldfieldtype": "Float",
"permlevel": 0,
"print_hide": 1,
"print_width": "70px",
"read_only": 0,
"fieldname": "discount_percentage",
"fieldtype": "Percent",
"in_list_view": 1,
"label": "Discount(%)",
"oldfieldname": "adj_rate",
"oldfieldtype": "Float",
"permlevel": 0,
"print_hide": 1,
"print_width": "70px",
"read_only": 0,
"width": "70px"
},
},
{
"fieldname": "col_break2",
"fieldtype": "Column Break",
"fieldname": "col_break2",
"fieldtype": "Column Break",
"permlevel": 0
},
},
{
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
"in_list_view": 1,
"label": "UOM",
"oldfieldname": "stock_uom",
"oldfieldtype": "Data",
"options": "UOM",
"permlevel": 0,
"print_width": "70px",
"read_only": 1,
"reqd": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
"in_list_view": 1,
"label": "UOM",
"oldfieldname": "stock_uom",
"oldfieldtype": "Data",
"options": "UOM",
"permlevel": 0,
"print_width": "70px",
"read_only": 1,
"reqd": 0,
"width": "70px"
},
},
{
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"label": "Price List Rate (Company Currency)",
"oldfieldname": "base_ref_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"label": "Price List Rate (Company Currency)",
"oldfieldname": "base_ref_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"width": "100px"
},
},
{
"fieldname": "section_break_simple1",
"fieldtype": "Section Break",
"fieldname": "section_break_simple1",
"fieldtype": "Section Break",
"permlevel": 0
},
},
{
"fieldname": "rate",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Rate",
"oldfieldname": "export_rate",
"oldfieldtype": "Currency",
"options": "currency",
"permlevel": 0,
"print_width": "100px",
"read_only": 0,
"reqd": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Rate",
"oldfieldname": "export_rate",
"oldfieldtype": "Currency",
"options": "currency",
"permlevel": 0,
"print_width": "100px",
"read_only": 0,
"reqd": 0,
"width": "100px"
},
},
{
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount",
"no_copy": 0,
"oldfieldname": "export_amount",
"oldfieldtype": "Currency",
"options": "currency",
"permlevel": 0,
"print_width": "100px",
"read_only": 1,
"reqd": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount",
"no_copy": 0,
"oldfieldname": "export_amount",
"oldfieldtype": "Currency",
"options": "currency",
"permlevel": 0,
"print_width": "100px",
"read_only": 1,
"reqd": 0,
"width": "100px"
},
},
{
"fieldname": "col_break3",
"fieldtype": "Column Break",
"fieldname": "col_break3",
"fieldtype": "Column Break",
"permlevel": 0
},
},
{
"fieldname": "base_rate",
"fieldtype": "Currency",
"label": "Basic Rate (Company Currency)",
"oldfieldname": "basic_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"reqd": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"label": "Basic Rate (Company Currency)",
"oldfieldname": "basic_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"reqd": 0,
"width": "100px"
},
},
{
"fieldname": "base_amount",
"fieldtype": "Currency",
"label": "Amount (Company Currency)",
"no_copy": 0,
"oldfieldname": "amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"reqd": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"label": "Amount (Company Currency)",
"no_copy": 0,
"oldfieldname": "amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"reqd": 0,
"width": "100px"
},
},
{
"fieldname": "pricing_rule",
"fieldtype": "Link",
"label": "Pricing Rule",
"options": "Pricing Rule",
"permlevel": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"label": "Pricing Rule",
"options": "Pricing Rule",
"permlevel": 0,
"read_only": 1
},
},
{
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"label": "Warehouse and Reference",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"label": "Warehouse and Reference",
"permlevel": 0
},
},
{
"fieldname": "warehouse",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Reserved Warehouse",
"no_copy": 0,
"oldfieldname": "reserved_warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"permlevel": 0,
"print_hide": 1,
"print_width": "150px",
"read_only": 0,
"reqd": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Reserved Warehouse",
"no_copy": 0,
"oldfieldname": "reserved_warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"permlevel": 0,
"print_hide": 1,
"print_width": "150px",
"read_only": 0,
"reqd": 0,
"width": "150px"
},
},
{
"fieldname": "prevdoc_docname",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "Quotation",
"no_copy": 1,
"oldfieldname": "prevdoc_docname",
"oldfieldtype": "Link",
"options": "Quotation",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"fieldname": "prevdoc_docname",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "Quotation",
"no_copy": 1,
"oldfieldname": "prevdoc_docname",
"oldfieldtype": "Link",
"options": "Quotation",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"search_index": 1
},
},
{
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
"in_filter": 1,
"label": "Brand Name",
"oldfieldname": "brand",
"oldfieldtype": "Link",
"options": "Brand",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
"in_filter": 1,
"label": "Brand Name",
"oldfieldname": "brand",
"oldfieldtype": "Link",
"options": "Brand",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"search_index": 1
},
},
{
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 1,
"in_filter": 1,
"label": "Item Group",
"oldfieldname": "item_group",
"oldfieldtype": "Link",
"options": "Item Group",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 1,
"in_filter": 1,
"label": "Item Group",
"oldfieldname": "item_group",
"oldfieldtype": "Link",
"options": "Item Group",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"search_index": 1
},
},
{
"allow_on_submit": 1,
"fieldname": "page_break",
"fieldtype": "Check",
"label": "Page Break",
"oldfieldname": "page_break",
"oldfieldtype": "Check",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"allow_on_submit": 1,
"fieldname": "page_break",
"fieldtype": "Check",
"label": "Page Break",
"oldfieldname": "page_break",
"oldfieldtype": "Check",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 1
},
},
{
"fieldname": "col_break4",
"fieldtype": "Column Break",
"fieldname": "col_break4",
"fieldtype": "Column Break",
"permlevel": 0
},
},
{
"allow_on_submit": 1,
"fieldname": "projected_qty",
"fieldtype": "Float",
"hidden": 0,
"label": "Projected Qty",
"no_copy": 1,
"oldfieldname": "projected_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "70px",
"read_only": 1,
"allow_on_submit": 1,
"fieldname": "projected_qty",
"fieldtype": "Float",
"hidden": 0,
"label": "Projected Qty",
"no_copy": 1,
"oldfieldname": "projected_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "70px",
"read_only": 1,
"width": "70px"
},
},
{
"allow_on_submit": 1,
"fieldname": "actual_qty",
"fieldtype": "Float",
"label": "Actual Qty",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"print_width": "70px",
"read_only": 1,
"allow_on_submit": 1,
"fieldname": "actual_qty",
"fieldtype": "Float",
"label": "Actual Qty",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"print_width": "70px",
"read_only": 1,
"width": "70px"
},
},
{
"fieldname": "delivered_qty",
"fieldtype": "Float",
"hidden": 0,
"in_filter": 0,
"label": "Delivered Qty",
"no_copy": 1,
"oldfieldname": "delivered_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"search_index": 0,
"fieldname": "delivered_qty",
"fieldtype": "Float",
"hidden": 0,
"in_filter": 0,
"label": "Delivered Qty",
"no_copy": 1,
"oldfieldname": "delivered_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"search_index": 0,
"width": "100px"
},
},
{
"fieldname": "billed_amt",
"fieldtype": "Currency",
"label": "Billed Amt",
"no_copy": 1,
"options": "currency",
"permlevel": 0,
"print_hide": 1,
"fieldname": "billed_amt",
"fieldtype": "Currency",
"label": "Billed Amt",
"no_copy": 1,
"options": "currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
},
{
"description": "For Production",
"fieldname": "planned_qty",
"fieldtype": "Float",
"hidden": 1,
"label": "Planned Quantity",
"no_copy": 1,
"oldfieldname": "planned_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "50px",
"read_only": 1,
"report_hide": 1,
"description": "For Production",
"fieldname": "planned_qty",
"fieldtype": "Float",
"hidden": 1,
"label": "Planned Quantity",
"no_copy": 1,
"oldfieldname": "planned_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "50px",
"read_only": 1,
"report_hide": 1,
"width": "50px"
},
},
{
"description": "For Production",
"fieldname": "produced_qty",
"fieldtype": "Float",
"hidden": 1,
"label": "Produced Quantity",
"oldfieldname": "produced_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "50px",
"read_only": 1,
"report_hide": 1,
"description": "For Production",
"fieldname": "produced_qty",
"fieldtype": "Float",
"hidden": 1,
"label": "Produced Quantity",
"oldfieldname": "produced_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "50px",
"read_only": 1,
"report_hide": 1,
"width": "50px"
},
},
{
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Item Tax Rate",
"oldfieldname": "item_tax_rate",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Item Tax Rate",
"oldfieldname": "item_tax_rate",
"oldfieldtype": "Small Text",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 1
},
},
{
"description": "Used for Production Plan",
"fieldname": "transaction_date",
"fieldtype": "Date",
"hidden": 1,
"in_filter": 0,
"label": "Sales Order Date",
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 1,
"description": "Used for Production Plan",
"fieldname": "transaction_date",
"fieldtype": "Date",
"hidden": 1,
"in_filter": 0,
"label": "Sales Order Date",
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 1,
"search_index": 0
}
],
"idx": 1,
"istable": 1,
"modified": "2015-02-18 12:50:20.121459",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
],
"idx": 1,
"istable": 1,
"modified": "2015-02-19 01:07:02.025024",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@ -28,7 +28,7 @@
"reqd": 1
},
{
"description": "Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.",
"description": "",
"fieldname": "abbr",
"fieldtype": "Data",
"label": "Abbr",
@ -52,6 +52,14 @@
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "default_letter_head",
"fieldtype": "Link",
"label": "Default Letter Head",
"options": "Letter Head",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "domain",
"fieldtype": "Select",
@ -64,9 +72,17 @@
"fieldname": "charts_section",
"fieldtype": "Section Break",
"hidden": 0,
"label": "Chart of Accounts",
"label": "Localization",
"permlevel": 0
},
{
"fieldname": "default_holiday_list",
"fieldtype": "Link",
"label": "Default Holiday List",
"options": "Holiday List",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "country",
"fieldtype": "Link",
@ -76,6 +92,22 @@
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "column_break_10",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "default_currency",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Default Currency",
"options": "Currency",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "chart_of_accounts",
"fieldtype": "Select",
@ -130,6 +162,14 @@
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0,
"width": "50%"
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_payable_account",
@ -164,36 +204,8 @@
"permlevel": 0
},
{
"fieldname": "default_holiday_list",
"fieldtype": "Link",
"label": "Default Holiday List",
"options": "Holiday List",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"read_only": 0,
"width": "50%"
},
{
"fieldname": "default_currency",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Default Currency",
"options": "Currency",
"permlevel": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "default_letter_head",
"fieldtype": "Link",
"label": "Default Letter Head",
"options": "Letter Head",
"fieldname": "section_break_22",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
@ -228,6 +240,12 @@
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "column_break_26",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "yearly_bgt_flag",
@ -278,6 +296,12 @@
"permlevel": 0,
"read_only": 0
},
{
"fieldname": "column_break_32",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
{
"fieldname": "expenses_included_in_valuation",
"fieldtype": "Link",
@ -375,7 +399,7 @@
],
"icon": "icon-building",
"idx": 1,
"modified": "2015-02-05 05:11:35.790597",
"modified": "2015-02-19 00:37:55.472911",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",

View File

@ -1,5 +1,5 @@
{
"autoname": "DND/.#######",
"autoname": "hash",
"creation": "2013-04-22 13:15:44",
"docstatus": 0,
"doctype": "DocType",
@ -467,7 +467,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-12 15:19:29.701710",
"modified": "2015-02-19 01:06:59.675246",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",

View File

@ -1,6 +1,6 @@
{
"autoname": "ITEMCUST/.#####",
"creation": "2013-03-08 15:37:16.000000",
"autoname": "hash",
"creation": "2013-03-08 15:37:16",
"description": "For the convenience of customers, these codes can be used in print formats like Invoices and Delivery Notes",
"docstatus": 0,
"doctype": "DocType",
@ -38,10 +38,11 @@
"idx": 1,
"in_create": 0,
"istable": 1,
"modified": "2013-12-20 19:23:16.000000",
"modified": "2015-02-19 01:07:00.255330",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Customer Detail",
"owner": "Administrator",
"permissions": [],
"read_only": 0
}

View File

@ -1,6 +1,6 @@
{
"autoname": "IISD/.#####",
"creation": "2013-02-22 01:28:01.000000",
"autoname": "hash",
"creation": "2013-02-22 01:28:01",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -30,9 +30,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-20 19:23:16.000000",
"modified": "2015-02-19 01:07:00.296584",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Quality Inspection Parameter",
"owner": "Administrator"
"owner": "Administrator",
"permissions": []
}

View File

@ -1,6 +1,6 @@
{
"autoname": "REORD-.#####",
"creation": "2013-03-07 11:42:59.000000",
"autoname": "hash",
"creation": "2013-03-07 11:42:59",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -45,9 +45,10 @@
"idx": 1,
"in_create": 1,
"istable": 1,
"modified": "2013-12-20 19:23:16.000000",
"modified": "2015-02-19 01:07:00.334482",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Reorder",
"owner": "Administrator"
"owner": "Administrator",
"permissions": []
}

View File

@ -1,5 +1,5 @@
{
"autoname": "MREQD-.#####",
"autoname": "hash",
"creation": "2013-02-22 01:28:02",
"docstatus": 0,
"doctype": "DocType",
@ -264,7 +264,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-12 15:20:02.832792",
"modified": "2015-02-19 01:07:00.695393",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request Item",

View File

@ -1,5 +1,5 @@
{
"autoname": "PSD/.#######",
"autoname": "hash",
"creation": "2013-04-08 13:10:16",
"docstatus": 0,
"doctype": "DocType",
@ -90,7 +90,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2014-09-09 05:35:38.604554",
"modified": "2015-02-19 01:07:00.840553",
"modified_by": "Administrator",
"module": "Stock",
"name": "Packing Slip Item",

View File

@ -1,5 +1,5 @@
{
"autoname": "GRND/.#######",
"autoname": "hash",
"creation": "2013-05-24 19:29:10",
"docstatus": 0,
"doctype": "DocType",
@ -588,7 +588,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-12 15:20:26.299671",
"modified": "2015-02-19 01:07:01.405923",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",

View File

@ -13,6 +13,7 @@ from erpnext.stock.stock_ledger import get_previous_sle, NegativeStockError
from erpnext.controllers.queries import get_match_cond
from erpnext.stock.get_item_details import get_available_qty, get_default_cost_center, get_conversion_factor
from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
from erpnext.accounts.utils import validate_fiscal_year
class NotUpdateStockError(frappe.ValidationError): pass
class StockOverReturnError(frappe.ValidationError): pass
@ -48,6 +49,8 @@ class StockEntry(StockController):
pro_obj = self.production_order and \
frappe.get_doc('Production Order', self.production_order) or None
validate_fiscal_year(self.posting_date, self.fiscal_year, self.meta.get_label("posting_date"), self)
self.validate_item()
self.set_transfer_qty()
self.validate_uom_is_integer("uom", "qty")
@ -59,8 +62,7 @@ class StockEntry(StockController):
self.validate_finished_goods()
self.validate_return_reference_doc()
self.validate_with_material_request()
self.validate_fiscal_year()
self.validate_valuation_rate()
#self.validate_valuation_rate()
self.set_total_amount()
def on_submit(self):
@ -76,11 +78,6 @@ class StockEntry(StockController):
self.update_production_order()
self.make_gl_entries_on_cancel()
def validate_fiscal_year(self):
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year,
self.meta.get_label("posting_date"))
def validate_purpose(self):
valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer", "Material Transfer for Manufacture",
"Manufacture", "Repack", "Subcontract", "Sales Return", "Purchase Return"]
@ -220,8 +217,9 @@ class StockEntry(StockController):
if d.t_warehouse and not d.s_warehouse:
valuation_at_target += flt(d.amount)
if valuation_at_target < valuation_at_source:
frappe.throw(_("Total valuation for manufactured or repacked item(s) can not be less than total valuation of raw materials"))
if valuation_at_target + 0.001 < valuation_at_source:
frappe.throw(_("Total valuation ({0}) for manufactured or repacked item(s) can not be less than total valuation of raw materials ({1})").format(valuation_at_target,
valuation_at_source))
def set_total_amount(self):
self.total_amount = sum([flt(item.amount) for item in self.get("items")])
@ -419,7 +417,7 @@ class StockEntry(StockController):
_validate_production_order(pro_doc)
pro_doc.run_method("update_status")
if self.purpose == "Manufacture":
pro_doc.run_method("update_produced_qty")
pro_doc.run_method("update_production_order_qty")
self.update_planned_qty(pro_doc)
def update_planned_qty(self, pro_doc):

View File

@ -1,5 +1,5 @@
{
"autoname": "MTND/.######",
"autoname": "hash",
"creation": "2013-03-29 18:22:12",
"docstatus": 0,
"doctype": "DocType",
@ -331,7 +331,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2015-02-12 15:20:56.815434",
"modified": "2015-02-19 01:07:02.254835",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",

View File

@ -21,8 +21,7 @@ class StockLedgerEntry(Document):
self.scrub_posting_time()
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year,
self.meta.get_label("posting_date"))
validate_fiscal_year(self.posting_date, self.fiscal_year, self.meta.get_label("posting_date"), self)
def on_submit(self):
self.check_stock_frozen_date()
@ -67,10 +66,10 @@ class StockLedgerEntry(Document):
frappe.throw(_("Batch number is mandatory for Item {0}").format(self.item_code))
elif not frappe.db.get_value("Batch",{"item": self.item_code, "name": self.batch_no}):
frappe.throw(_("{0} is not a valid Batch Number for Item {1}").format(self.batch_no, self.item_code))
elif item_det.has_batch_no =='No' and self.batch_no:
frappe.throw(_("The Item {0} cannot have Batch").format(self.item_code))
if item_det.has_variants:
frappe.throw(_("Stock cannot exist for Item {0} since has variants").format(self.item_code),
ItemTemplateCannotHaveStock)

View File

@ -1,6 +1,6 @@
{
"autoname": "UCDD/.#####",
"creation": "2013-02-22 01:28:04.000000",
"autoname": "hash",
"creation": "2013-02-22 01:28:04",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -26,9 +26,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-20 19:21:53.000000",
"modified": "2015-02-19 01:07:02.522989",
"modified_by": "Administrator",
"module": "Stock",
"name": "UOM Conversion Detail",
"owner": "Administrator"
"owner": "Administrator",
"permissions": []
}

View File

@ -1,6 +1,6 @@
{
"autoname": "MSD.#####",
"creation": "2013-02-22 01:28:05.000000",
"autoname": "hash",
"creation": "2013-02-22 01:28:05",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -89,9 +89,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-31 12:13:38.000000",
"modified": "2015-02-19 01:07:00.495149",
"modified_by": "Administrator",
"module": "Support",
"name": "Maintenance Schedule Detail",
"owner": "Administrator"
"owner": "Administrator",
"permissions": []
}

View File

@ -1,6 +1,6 @@
{
"autoname": "IMD.#####",
"creation": "2013-02-22 01:28:05.000000",
"autoname": "hash",
"creation": "2013-02-22 01:28:05",
"docstatus": 0,
"doctype": "DocType",
"fields": [
@ -133,9 +133,10 @@
],
"idx": 1,
"istable": 1,
"modified": "2013-12-31 12:08:32.000000",
"modified": "2015-02-19 01:07:00.550040",
"modified_by": "Administrator",
"module": "Support",
"name": "Maintenance Schedule Item",
"owner": "Administrator"
"owner": "Administrator",
"permissions": []
}

View File

@ -1,5 +1,5 @@
{
"autoname": "MVD.#####",
"autoname": "hash",
"creation": "2013-02-22 01:28:06",
"docstatus": 0,
"doctype": "DocType",
@ -123,7 +123,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2014-07-07 02:53:48.442249",
"modified": "2015-02-19 01:07:00.623383",
"modified_by": "Administrator",
"module": "Support",
"name": "Maintenance Visit Purpose",