[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", "creation": "2013-03-07 11:55:04",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -44,7 +44,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2014-05-09 02:12:39.595788", "modified": "2015-02-19 01:06:59.471417",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Budget Detail", "name": "Budget Detail",

View File

@@ -53,7 +53,7 @@ class GLEntry(Document):
def validate_posting_date(self): def validate_posting_date(self):
from erpnext.accounts.utils import validate_fiscal_year 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): def check_pl_account(self):
if self.is_opening=='Yes' and \ if self.is_opening=='Yes' and \

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
{ {
"autoname": "PVTD.######", "autoname": "hash",
"creation": "2013-05-21 16:16:04", "creation": "2013-05-21 16:16:04",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -155,7 +155,7 @@
"hide_heading": 1, "hide_heading": 1,
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2014-05-30 03:43:32.494112", "modified": "2015-02-19 01:07:01.581115",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Taxes and Charges", "name": "Purchase Taxes and Charges",

View File

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

View File

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

View File

@@ -41,9 +41,12 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb
raise FiscalYearError, error_msg raise FiscalYearError, error_msg
return fy 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)] years = [f[0] for f in get_fiscal_years(date, label=label)]
if fiscal_year not in years: if fiscal_year not in years:
if doc:
doc.fiscal_year = years[0]
else:
throw(_("{0} '{1}' not in Fiscal Year {2}").format(label, formatdate(date), fiscal_year)) throw(_("{0} '{1}' not in Fiscal Year {2}").format(label, formatdate(date), fiscal_year))
@frappe.whitelist() @frappe.whitelist()

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"autoname": "QASD/.#####", "autoname": "hash",
"creation": "2013-02-22 01:27:43.000000", "creation": "2013-02-22 01:27:43",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
@@ -120,9 +120,10 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2013-12-20 19:23:39.000000", "modified": "2015-02-19 01:07:01.658125",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Quality Inspection Reading", "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", "creation": "2013-05-22 12:43:10",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -360,7 +360,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2015-02-12 15:16:13.616428", "modified": "2015-02-19 01:07:02.403267",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier Quotation Item", "name": "Supplier Quotation Item",

View File

@@ -69,7 +69,7 @@ class AccountsController(TransactionBase):
if date_field and self.get(date_field): if date_field and self.get(date_field):
validate_fiscal_year(self.get(date_field), self.fiscal_year, 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): def validate_due_date(self):
from erpnext.accounts.party import validate_due_date from erpnext.accounts.party import validate_due_date

View File

@@ -29,7 +29,7 @@ class Opportunity(TransactionBase):
self.validate_cust_name() self.validate_cust_name()
from erpnext.accounts.utils import validate_fiscal_year 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): def on_submit(self):
if self.lead: if self.lead:

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"autoname": "KSHEET.#####", "autoname": "hash",
"creation": "2013-02-22 01:27:44.000000", "creation": "2013-02-22 01:27:44",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
@@ -32,9 +32,10 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2013-12-20 19:22:54.000000", "modified": "2015-02-19 01:06:59.356774",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Appraisal Template Goal", "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, frappe.throw(_("Employee {0} was on leave on {1}. Cannot mark attendance.").format(self.employee,
self.att_date)) 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): def validate_att_date(self):
if getdate(self.att_date) > getdate(nowdate()): if getdate(self.att_date) > getdate(nowdate()):
frappe.throw(_("Attendance can not be marked for future dates")) frappe.throw(_("Attendance can not be marked for future dates"))
@@ -45,8 +41,9 @@ class Attendance(Document):
def validate(self): def validate(self):
from erpnext.utilities import validate_status from erpnext.utilities import validate_status
from erpnext.accounts.utils import validate_fiscal_year
validate_status(self.status, ["Present", "Absent", "Half Day"]) 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_att_date()
self.validate_duplicate_record() self.validate_duplicate_record()
self.check_leave_record() self.check_leave_record()

View File

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

View File

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

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) { frappe.ui.form.on("BOM Operation", "operation", function(frm, cdt, cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if(!d.operation) return;
frappe.call({ frappe.call({
"method": "frappe.client.get", "method": "frappe.client.get",
args: { args: {

View File

@@ -14,10 +14,9 @@ class BOM(Document):
def autoname(self): def autoname(self):
last_name = frappe.db.sql("""select max(name) from `tabBOM` 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: if last_name:
idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1 idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1
else: else:
idx = 1 idx = 1
self.name = 'BOM/' + self.item + ('/%.3i' % idx) self.name = 'BOM/' + self.item + ('/%.3i' % idx)

View File

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

View File

@@ -1,43 +1,144 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, { frappe.ui.form.on("Production Order", "onload", function(frm) {
onload: function (doc, dt, dn) { if (!frm.doc.status)
if (!doc.status) doc.status = 'Draft'; frm.doc.status = 'Draft';
cfn_set_fields(doc, dt, dn);
this.frm.add_fetch("sales_order", "delivery_date", "expected_delivery_date"); frm.add_fetch("sales_order", "delivery_date", "expected_delivery_date");
if(doc.__islocal) { if(frm.doc.__islocal) {
cur_frm.set_value({ frm.set_value({
"actual_start_date": "", "actual_start_date": "",
"actual_end_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);
}
})
});
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)
});
erpnext.production_order = {
set_custom_buttons: function(frm) {
var doc = frm.doc;
if (doc.docstatus === 1) {
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.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() { before_submit: function() {
cur_frm.toggle_reqd(["fg_warehouse", "wip_warehouse"], true); cur_frm.toggle_reqd(["fg_warehouse", "wip_warehouse"], true);
}, },
refresh: function(doc, dt, dn) {
this.frm.dashboard.reset();
erpnext.toggle_naming_series();
this.frm.set_intro("");
cfn_set_fields(doc, dt, dn);
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.status === "Stopped") {
this.frm.dashboard.set_headline_alert(__("Stopped"), "alert-danger", "icon-stop");
}
}
},
production_item: function(doc) { production_item: function(doc) {
frappe.call({ frappe.call({
method: "erpnext.manufacturing.doctype.production_order.production_order.get_item_details", method: "erpnext.manufacturing.doctype.production_order.production_order.get_item_details",
@@ -105,29 +206,9 @@ $.extend(cur_frm.cscript, {
"production_order_id": doc.name "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() { cur_frm.cscript['Stop Production Order'] = function() {
var doc = cur_frm.doc; var doc = cur_frm.doc;
var check = confirm(__("Do you really want to stop production order: " + doc.name)); 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, "read_only": 0,
"reqd": 1 "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", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
@@ -85,6 +93,15 @@
"read_only": 0, "read_only": 0,
"reqd": 1 "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", "default": "0",
"depends_on": "eval:doc.docstatus==1", "depends_on": "eval:doc.docstatus==1",
@@ -99,13 +116,37 @@
"read_only": 1 "read_only": 1
}, },
{ {
"default": "1", "fieldname": "warehouses",
"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.", "fieldtype": "Section Break",
"fieldname": "use_multi_level_bom", "label": "Warehouses",
"fieldtype": "Check", "options": "icon-building",
"label": "Use Multi-Level BOM",
"permlevel": 0 "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", "fieldname": "time",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@@ -158,38 +199,6 @@
"precision": "", "precision": "",
"read_only": 1 "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": "", "depends_on": "",
"fieldname": "operations_section", "fieldname": "operations_section",
@@ -351,7 +360,7 @@
"idx": 1, "idx": 1,
"in_create": 0, "in_create": 0,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-02-05 05:11:42.851377", "modified": "2015-02-19 03:58:23.460022",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Order", "name": "Production Order",

View File

@@ -120,16 +120,20 @@ class ProductionOrder(Document):
if status != self.status: if status != self.status:
self.db_set("status", status) self.db_set("status", status)
def update_produced_qty(self): def update_production_order_qty(self):
produced_qty = frappe.db.sql("""select sum(fg_completed_qty) """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 from `tabStock Entry` where production_order=%s and docstatus=1
and purpose='Manufacture'""", self.name) and purpose=%s""", (self.name, status))[0][0])
produced_qty = flt(produced_qty[0][0]) if produced_qty else 0
if produced_qty > self.qty: if 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) 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): def on_submit(self):
if not self.wip_warehouse: if not self.wip_warehouse:
@@ -223,10 +227,6 @@ class ProductionOrder(Document):
def validate_delivery_date(self): def validate_delivery_date(self):
if self.docstatus==1: 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 \ if self.planned_end_date and self.expected_delivery_date \
and getdate(self.expected_delivery_date) < getdate(self.planned_end_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.")) 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]: if filters[key]:
conditions += " and " + key + ' = "' + filters[key].replace('"', '\"') + '"' 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` from `tabProduction Order`
where ((ifnull(production_start_date, '0000-00-00')!= '0000-00-00') \ where ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
and (production_start_date between %(start)s and %(end)s) \ and (planned_start_date between %(start)s and %(end)s) \
or ((ifnull(production_start_date, '0000-00-00')!= '0000-00-00') \ or ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
and production_end_date between %(start)s and %(end)s)) {conditions} and planned_end_date between %(start)s and %(end)s)) {conditions}
""".format(conditions=conditions), { """.format(conditions=conditions), {
"start": start, "start": start,
"end": end "end": end

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"autoname": "PPID/.#####", "autoname": "hash",
"creation": "2013-02-22 01:27:49.000000", "creation": "2013-02-22 01:27:49",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
@@ -104,9 +104,10 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2013-12-20 19:23:25.000000", "modified": "2015-02-19 01:07:00.936590",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Plan Item", "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", "creation": "2013-02-22 01:27:49",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -59,7 +59,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2015-02-17 14:29:14.479541", "modified": "2015-02-19 01:07:00.991795",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Plan Sales Order", "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.update_material_transfer_for_manufacture
erpnext.patches.v5_0.manufacturing_activity_type erpnext.patches.v5_0.manufacturing_activity_type
erpnext.patches.v5_0.update_item_description_and_image 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") user_desktop_items.append("CRM")
frappe.db.set_default(key, json.dumps(user_desktop_items), parent=user) 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; 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 // set hours if to_time is updated
frappe.ui.form.on("Time Log", "to_time", function(frm) { frappe.ui.form.on("Time Log", "to_time", function(frm) {
if(frm._setting_hours) return; if(frm._setting_hours) return;

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"autoname": "IID/.#####", "autoname": "hash",
"creation": "2013-02-22 01:27:51.000000", "creation": "2013-02-22 01:27:51",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
@@ -100,9 +100,10 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2013-12-20 19:23:14.000000", "modified": "2015-02-19 01:07:00.200686",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Installation Note Item", "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", "creation": "2013-03-07 11:42:57",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -349,7 +349,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2015-02-12 15:18:41.236797", "modified": "2015-02-19 01:07:01.742936",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Quotation Item", "name": "Quotation Item",

View File

@@ -1,5 +1,5 @@
{ {
"autoname": "SOD/.#####", "autoname": "hash",
"creation": "2013-03-07 11:42:58", "creation": "2013-03-07 11:42:58",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -444,7 +444,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2015-02-18 12:50:20.121459", "modified": "2015-02-19 01:07:02.025024",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Sales Order Item", "name": "Sales Order Item",

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"autoname": "REORD-.#####", "autoname": "hash",
"creation": "2013-03-07 11:42:59.000000", "creation": "2013-03-07 11:42:59",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
@@ -45,9 +45,10 @@
"idx": 1, "idx": 1,
"in_create": 1, "in_create": 1,
"istable": 1, "istable": 1,
"modified": "2013-12-20 19:23:16.000000", "modified": "2015-02-19 01:07:00.334482",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Item Reorder", "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", "creation": "2013-02-22 01:28:02",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -264,7 +264,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2015-02-12 15:20:02.832792", "modified": "2015-02-19 01:07:00.695393",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Material Request Item", "name": "Material Request Item",

View File

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

View File

@@ -1,5 +1,5 @@
{ {
"autoname": "GRND/.#######", "autoname": "hash",
"creation": "2013-05-24 19:29:10", "creation": "2013-05-24 19:29:10",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -588,7 +588,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2015-02-12 15:20:26.299671", "modified": "2015-02-19 01:07:01.405923",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Purchase Receipt Item", "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.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.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.manufacturing.doctype.bom.bom import validate_bom_no
from erpnext.accounts.utils import validate_fiscal_year
class NotUpdateStockError(frappe.ValidationError): pass class NotUpdateStockError(frappe.ValidationError): pass
class StockOverReturnError(frappe.ValidationError): pass class StockOverReturnError(frappe.ValidationError): pass
@@ -48,6 +49,8 @@ class StockEntry(StockController):
pro_obj = self.production_order and \ pro_obj = self.production_order and \
frappe.get_doc('Production Order', self.production_order) or None 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.validate_item()
self.set_transfer_qty() self.set_transfer_qty()
self.validate_uom_is_integer("uom", "qty") self.validate_uom_is_integer("uom", "qty")
@@ -59,8 +62,7 @@ class StockEntry(StockController):
self.validate_finished_goods() self.validate_finished_goods()
self.validate_return_reference_doc() self.validate_return_reference_doc()
self.validate_with_material_request() self.validate_with_material_request()
self.validate_fiscal_year() #self.validate_valuation_rate()
self.validate_valuation_rate()
self.set_total_amount() self.set_total_amount()
def on_submit(self): def on_submit(self):
@@ -76,11 +78,6 @@ class StockEntry(StockController):
self.update_production_order() self.update_production_order()
self.make_gl_entries_on_cancel() 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): def validate_purpose(self):
valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer", "Material Transfer for Manufacture", valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer", "Material Transfer for Manufacture",
"Manufacture", "Repack", "Subcontract", "Sales Return", "Purchase Return"] "Manufacture", "Repack", "Subcontract", "Sales Return", "Purchase Return"]
@@ -220,8 +217,9 @@ class StockEntry(StockController):
if d.t_warehouse and not d.s_warehouse: if d.t_warehouse and not d.s_warehouse:
valuation_at_target += flt(d.amount) valuation_at_target += flt(d.amount)
if valuation_at_target < valuation_at_source: if valuation_at_target + 0.001 < valuation_at_source:
frappe.throw(_("Total valuation for manufactured or repacked item(s) can not be less than total valuation of raw materials")) 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): def set_total_amount(self):
self.total_amount = sum([flt(item.amount) for item in self.get("items")]) 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) _validate_production_order(pro_doc)
pro_doc.run_method("update_status") pro_doc.run_method("update_status")
if self.purpose == "Manufacture": 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) self.update_planned_qty(pro_doc)
def update_planned_qty(self, 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", "creation": "2013-03-29 18:22:12",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -331,7 +331,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2015-02-12 15:20:56.815434", "modified": "2015-02-19 01:07:02.254835",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Stock Entry Detail", "name": "Stock Entry Detail",

View File

@@ -21,8 +21,7 @@ class StockLedgerEntry(Document):
self.scrub_posting_time() self.scrub_posting_time()
from erpnext.accounts.utils import validate_fiscal_year from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year, validate_fiscal_year(self.posting_date, self.fiscal_year, self.meta.get_label("posting_date"), self)
self.meta.get_label("posting_date"))
def on_submit(self): def on_submit(self):
self.check_stock_frozen_date() self.check_stock_frozen_date()

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"autoname": "IMD.#####", "autoname": "hash",
"creation": "2013-02-22 01:28:05.000000", "creation": "2013-02-22 01:28:05",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
@@ -133,9 +133,10 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2013-12-31 12:08:32.000000", "modified": "2015-02-19 01:07:00.550040",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Support", "module": "Support",
"name": "Maintenance Schedule Item", "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", "creation": "2013-02-22 01:28:06",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
@@ -123,7 +123,7 @@
], ],
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"modified": "2014-07-07 02:53:48.442249", "modified": "2015-02-19 01:07:00.623383",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Support", "module": "Support",
"name": "Maintenance Visit Purpose", "name": "Maintenance Visit Purpose",