Merge branch 'develop' into leaderboard

This commit is contained in:
Suraj Shetty 2019-09-30 12:35:39 +05:30 committed by GitHub
commit 6bd4509923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 3 deletions

View File

@ -213,6 +213,9 @@ class WorkOrder(Document):
self.db_set(fieldname, qty)
from erpnext.selling.doctype.sales_order.sales_order import update_produced_qty_in_so_item
update_produced_qty_in_so_item(self.sales_order_item)
if self.production_plan:
self.update_production_plan_status()

View File

@ -637,3 +637,4 @@ erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit
erpnext.patches.v12_0.add_variant_of_in_item_attribute_table
erpnext.patches.v12_0.rename_bank_account_field_in_journal_entry_account
erpnext.patches.v12_0.create_default_energy_point_rules
erpnext.patches.v12_0.set_produced_qty_field_in_sales_order_for_work_order

View File

@ -0,0 +1,10 @@
import frappe
from frappe.utils import flt
from erpnext.selling.doctype.sales_order.sales_order import update_produced_qty_in_so_item
def execute():
frappe.reload_doctype('Sales Order Item')
frappe.reload_doctype('Sales Order')
sales_order_items = frappe.db.get_all('Sales Order Item', ['name'])
for so_item in sales_order_items:
update_produced_qty_in_so_item(so_item.get('name'))

View File

@ -1023,3 +1023,15 @@ def create_pick_list(source_name, target_doc=None):
doc.set_item_locations()
return doc
def update_produced_qty_in_so_item(sales_order_item):
#for multiple work orders against same sales order item
linked_wo_with_so_item = frappe.db.get_all('Work Order', ['produced_qty'], {
'sales_order_item': sales_order_item,
'docstatus': 1
})
if len(linked_wo_with_so_item) > 0:
total_produced_qty = 0
for wo in linked_wo_with_so_item:
total_produced_qty += flt(wo.get('produced_qty'))
frappe.db.set_value('Sales Order Item', sales_order_item, 'produced_qty', total_produced_qty)

View File

@ -110,6 +110,7 @@
"read_only": 1
},
{
"default": "0",
"fieldname": "ensure_delivery_based_on_produced_serial_no",
"fieldtype": "Check",
"label": "Ensure Delivery Based on Produced Serial No"
@ -381,6 +382,7 @@
"read_only": 1
},
{
"default": "0",
"fieldname": "is_free_item",
"fieldtype": "Check",
"label": "Is Free Item",
@ -436,6 +438,7 @@
"print_hide": 1
},
{
"default": "0",
"fieldname": "delivered_by_supplier",
"fieldtype": "Check",
"label": "Supplier delivers to Customer",
@ -662,6 +665,7 @@
},
{
"allow_on_submit": 1,
"default": "0",
"fieldname": "page_break",
"fieldtype": "Check",
"label": "Page Break",
@ -689,7 +693,6 @@
"description": "For Production",
"fieldname": "produced_qty",
"fieldtype": "Float",
"hidden": 1,
"label": "Produced Quantity",
"oldfieldname": "produced_qty",
"oldfieldtype": "Currency",
@ -740,7 +743,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2019-05-01 17:52:32.810797",
"modified": "2019-09-13 12:18:54.903107",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",