[usability] [fixes] stock entry and production order
This commit is contained in:
parent
d60acb9f26
commit
c7a11cc451
@ -11,5 +11,6 @@ frappe.listview_settings['Purchase Order'] = {
|
||||
} else if(flt(doc.per_received) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") {
|
||||
return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Stopped"];
|
||||
}
|
||||
}
|
||||
},
|
||||
order_by: "per_received asc, modified desc"
|
||||
};
|
||||
|
@ -151,18 +151,30 @@ $.extend(cur_frm.cscript, {
|
||||
|
||||
make_se: function(purpose) {
|
||||
var me = this;
|
||||
var max = (purpose === "Manufacture") ?
|
||||
flt(this.frm.doc.material_transferred_for_qty) - flt(this.frm.doc.produced_qty) :
|
||||
flt(this.frm.doc.qty) - flt(this.frm.doc.material_transferred_for_qty);
|
||||
|
||||
frappe.call({
|
||||
method:"erpnext.manufacturing.doctype.production_order.production_order.make_stock_entry",
|
||||
args: {
|
||||
"production_order_id": me.frm.doc.name,
|
||||
"purpose": purpose
|
||||
},
|
||||
callback: function(r) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
});
|
||||
frappe.prompt({fieldtype:"Int", label: __("Qty for {0}", [purpose]), fieldname:"qty",
|
||||
description: __("Max: {0}", [max]) },
|
||||
function(data) {
|
||||
if(data.qty > max) {
|
||||
frappe.msgprint(__("Quantity must not be more than {0}", [max]));
|
||||
return;
|
||||
}
|
||||
frappe.call({
|
||||
method:"erpnext.manufacturing.doctype.production_order.production_order.make_stock_entry",
|
||||
args: {
|
||||
"production_order_id": me.frm.doc.name,
|
||||
"purpose": purpose,
|
||||
"qty": data.qty
|
||||
},
|
||||
callback: function(r) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
});
|
||||
}, __("Select Quantity"), __("Make"));
|
||||
},
|
||||
|
||||
bom_no: function() {
|
||||
|
@ -123,17 +123,17 @@ class ProductionOrder(Document):
|
||||
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"),
|
||||
for purpose, 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])
|
||||
and purpose=%s""", (self.name, purpose))[0][0])
|
||||
|
||||
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)
|
||||
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(fieldname, qty)
|
||||
self.db_set(fieldname, qty)
|
||||
|
||||
def on_submit(self):
|
||||
if not self.wip_warehouse:
|
||||
|
@ -119,3 +119,4 @@ 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
|
||||
erpnext.patches.v5_0.stock_entry_update_value
|
||||
|
7
erpnext/patches/v5_0/stock_entry_update_value.py
Normal file
7
erpnext/patches/v5_0/stock_entry_update_value.py
Normal file
@ -0,0 +1,7 @@
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for d in frappe.db.get_all("Stock Entry"):
|
||||
se = frappe.get_doc("Stock Entry", d.name)
|
||||
se.set_total_incoming_outgoing_value()
|
||||
se.db_update()
|
@ -13,5 +13,6 @@ frappe.listview_settings['Sales Order'] = {
|
||||
} else if(flt(doc.per_delivered) == 100 && flt(doc.per_billed) == 100 && doc.status!=="Stopped") {
|
||||
return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"];
|
||||
}
|
||||
}
|
||||
},
|
||||
order_by: "per_delivered asc, modified desc"
|
||||
};
|
||||
|
@ -147,7 +147,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
refresh_field('items');
|
||||
calculate_total(doc, cdt, cdn);
|
||||
},
|
||||
|
||||
|
||||
incoming_rate: function(doc, cdt, cdn) {
|
||||
calculate_total(doc, cdt, cdn);
|
||||
},
|
||||
|
@ -265,6 +265,42 @@
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_19",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"fieldname": "total_incoming_value",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Incoming Value",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_22",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"fieldname": "total_outgoing_value",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Outgoing Value",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "value_difference",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Value Difference (Out - In)",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
|
||||
"fieldname": "sb1",
|
||||
@ -596,7 +632,7 @@
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-02-17 00:49:04.294855",
|
||||
"modified": "2015-02-19 04:53:05.361046",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Entry",
|
||||
|
@ -221,6 +221,16 @@ class StockEntry(StockController):
|
||||
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_incoming_outgoing_value(self):
|
||||
self.total_incoming_value = self.total_outgoing_value = 0.0
|
||||
for d in self.get("items"):
|
||||
if d.s_warehouse:
|
||||
self.total_incoming_value += flt(d.amount)
|
||||
if d.t_warehouse:
|
||||
self.total_outgoing_value += flt(d.amount)
|
||||
|
||||
self.value_difference = self.total_outgoing_value - self.total_incoming_value
|
||||
|
||||
def set_total_amount(self):
|
||||
self.total_amount = sum([flt(item.amount) for item in self.get("items")])
|
||||
|
||||
|
@ -60,12 +60,15 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Item Name",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Qty",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_8",
|
||||
@ -73,6 +76,14 @@
|
||||
"permlevel": 0,
|
||||
"precision": ""
|
||||
},
|
||||
{
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Item Name",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
@ -115,15 +126,31 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"fieldname": "incoming_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Qty",
|
||||
"oldfieldname": "qty",
|
||||
"label": "Valuation Rate",
|
||||
"oldfieldname": "incoming_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Amount",
|
||||
"oldfieldname": "amount",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "col_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "uom",
|
||||
@ -138,21 +165,15 @@
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "incoming_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Valuation Rate",
|
||||
"oldfieldname": "incoming_rate",
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Float",
|
||||
"label": "Conversion Factor",
|
||||
"oldfieldname": "conversion_factor",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "col_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "stock_uom",
|
||||
@ -168,27 +189,6 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Float",
|
||||
"label": "Conversion Factor",
|
||||
"oldfieldname": "conversion_factor",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Amount",
|
||||
"oldfieldname": "amount",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "serial_no_batch",
|
||||
"fieldtype": "Section Break",
|
||||
@ -331,7 +331,7 @@
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"modified": "2015-02-19 01:07:02.254835",
|
||||
"modified": "2015-02-19 05:33:06.289852",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Entry Detail",
|
||||
|
@ -99,7 +99,7 @@ class update_entries_after(object):
|
||||
self.precision = get_field_precision(frappe.get_meta("Stock Ledger Entry").get_field("stock_value"),
|
||||
currency=frappe.db.get_value("Company", self.company, "default_currency"))
|
||||
|
||||
self.prev_stock_value = self.stock_value
|
||||
self.prev_stock_value = self.previous_sle.stock_value or 0.0
|
||||
self.stock_queue = json.loads(self.previous_sle.stock_queue or "[]")
|
||||
self.valuation_method = get_valuation_method(self.item_code)
|
||||
self.stock_value_difference = 0.0
|
||||
|
@ -30,7 +30,7 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
|
||||
cur_frm.add_custom_button(__('From Warranty Claim'),
|
||||
function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.support.doctype.customer_issue.customer_issue.make_maintenance_visit",
|
||||
method: "erpnext.support.doctype.warranty_claim.warranty_claim.make_maintenance_visit",
|
||||
source_doctype: "Warranty Claim",
|
||||
get_query_filters: {
|
||||
status: ["in", "Open, Work in Progress"],
|
||||
|
@ -21,7 +21,7 @@ erpnext.support.WarrantyClaim = frappe.ui.form.Controller.extend({
|
||||
|
||||
make_maintenance_visit: function() {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.support.doctype.customer_issue.customer_issue.make_maintenance_visit",
|
||||
method: "erpnext.support.doctype.warranty_claim.warranty_claim.make_maintenance_visit",
|
||||
frm: cur_frm
|
||||
})
|
||||
}
|
||||
|
@ -5,32 +5,34 @@
|
||||
|
||||
{% if(!doc) { %}
|
||||
<div class="row">
|
||||
<div class="col-sm-8 col-xs-6">{%= __("Item") %}</div>
|
||||
<div class="col-sm-5 col-xs-4">{%= __("Item") %}</div>
|
||||
<div class="col-sm-3 col-xs-4">{%= __("Warehouse") %}</div>
|
||||
<div class="col-sm-2 col-xs-2 text-right">{%= __("Qty") %}</div>
|
||||
<div class="col-sm-2 col-xs-4 text-right">{%= __("Amount") %}</div>
|
||||
<div class="col-sm-2 col-xs-2 text-right">{%= __("Amount") %}</div>
|
||||
</div>
|
||||
{% } else { %}
|
||||
<div class="row">
|
||||
<div class="col-sm-8 col-xs-6"><strong>{%= doc.item_code %}</strong>
|
||||
<div class="col-sm-5 col-xs-4"><strong>{%= doc.item_code %}</strong>
|
||||
{% if(doc.item_name != doc.item_code) { %}
|
||||
<br>{%= doc.item_name %}{% } %}
|
||||
{% if(doc.item_name != doc.description) { %}
|
||||
<p>{%= doc.description %}</p>{% } %}
|
||||
{% include "templates/form_grid/includes/visible_cols.html" %}
|
||||
<div>
|
||||
{% if(doc.s_warehouse) { %}
|
||||
<span class="label label-primary">
|
||||
{%= doc.s_warehouse || "" %}</span>
|
||||
{% } %}
|
||||
<i class="octicon octicon-arrow-small-right"></i>
|
||||
{% if(doc.t_warehouse) { %}<span class="label label-primary">
|
||||
{%= doc.t_warehouse || "" %}</span>{% } %}
|
||||
{% if(doc.s_warehouse && doc.actual_qty < doc.qty) { %}
|
||||
<span class="text-danger small" style="margin-left: 15px;">
|
||||
<span class="octicon octicon-stop" style="font-size: 12px;"></span> Not in Stock
|
||||
</span>
|
||||
{% } %}
|
||||
</div>
|
||||
{% if(frm.doc.docstatus==0 && doc.s_warehouse && doc.actual_qty < doc.qty) { %}
|
||||
<span class="text-danger small" style="margin-left: 15px;">
|
||||
<span class="octicon octicon-stop" style="font-size: 12px;"></span> Not in Stock
|
||||
</span>
|
||||
{% } %}
|
||||
</div>
|
||||
|
||||
<!-- warehouse -->
|
||||
<div class="col-sm-3 col-xs-4">
|
||||
{% if(doc.s_warehouse) { %}
|
||||
<span class="label label-default" title="{% __("Source" )%}">
|
||||
{%= doc.s_warehouse || "" %}</span>
|
||||
{% } %}
|
||||
{% if(doc.t_warehouse) { %}<span class="label label-primary" title="{% __("Target" )%}">
|
||||
{%= doc.t_warehouse || "" %}</span>{% } %}
|
||||
</div>
|
||||
|
||||
<!-- qty -->
|
||||
@ -40,7 +42,7 @@
|
||||
</div>
|
||||
|
||||
<!-- amount -->
|
||||
<div class="col-sm-2 col-xs-4 text-right">
|
||||
<div class="col-sm-2 col-xs-2 text-right">
|
||||
{%= doc.get_formatted("amount") %}
|
||||
<div class="small text-muted">
|
||||
{%= doc.get_formatted("incoming_rate") %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user