Merge branch 'develop' into dev_enhance_upgrade_process

This commit is contained in:
HENRY Florian 2022-08-29 10:49:11 +02:00 committed by GitHub
commit 61c143cb82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 16 deletions

View File

@ -14,8 +14,8 @@ pos* @nextchamp-saqib
erpnext/buying/ @rohitwaghchaure @s-aga-r erpnext/buying/ @rohitwaghchaure @s-aga-r
erpnext/maintenance/ @rohitwaghchaure @s-aga-r erpnext/maintenance/ @rohitwaghchaure @s-aga-r
erpnext/manufacturing/ @rohitwaghchaure @s-aga-r erpnext/manufacturing/ @rohitwaghchaure @s-aga-r
erpnext/quality_management/ @marination @rohitwaghchaure @s-aga-r erpnext/quality_management/ @rohitwaghchaure @s-aga-r
erpnext/stock/ @marination @rohitwaghchaure @s-aga-r erpnext/stock/ @rohitwaghchaure @s-aga-r
erpnext/crm/ @NagariaHussain erpnext/crm/ @NagariaHussain
erpnext/education/ @rutwikhdev erpnext/education/ @rutwikhdev

View File

@ -282,7 +282,6 @@
"label": "Discount (%) on Price List Rate with Margin", "label": "Discount (%) on Price List Rate with Margin",
"oldfieldname": "adj_rate", "oldfieldname": "adj_rate",
"oldfieldtype": "Float", "oldfieldtype": "Float",
"precision": "2",
"print_hide": 1 "print_hide": 1
}, },
{ {
@ -846,7 +845,7 @@
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2022-06-17 05:33:15.335912", "modified": "2022-08-26 12:06:31.205417",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice Item", "name": "Sales Invoice Item",

View File

@ -2229,7 +2229,7 @@ class StockEntry(StockController):
return sorted(list(set(get_serial_nos(self.pro_doc.serial_no)) - set(used_serial_nos))) return sorted(list(set(get_serial_nos(self.pro_doc.serial_no)) - set(used_serial_nos)))
def update_subcontracting_order_status(self): def update_subcontracting_order_status(self):
if self.subcontracting_order and self.purpose == "Send to Subcontractor": if self.subcontracting_order and self.purpose in ["Send to Subcontractor", "Material Transfer"]:
from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import ( from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import (
update_subcontracting_order_status, update_subcontracting_order_status,
) )

View File

@ -107,9 +107,9 @@ frappe.ui.form.on('Subcontracting Order', {
get_materials_from_supplier: function (frm) { get_materials_from_supplier: function (frm) {
let sco_rm_details = []; let sco_rm_details = [];
if (frm.doc.supplied_items && (frm.doc.per_received == 100)) { if (frm.doc.supplied_items && frm.doc.per_received > 0) {
frm.doc.supplied_items.forEach(d => { frm.doc.supplied_items.forEach(d => {
if (d.total_supplied_qty && d.total_supplied_qty != d.consumed_qty) { if (d.total_supplied_qty > 0 && d.total_supplied_qty != d.consumed_qty) {
sco_rm_details.push(d.name); sco_rm_details.push(d.name);
} }
}); });
@ -160,7 +160,7 @@ erpnext.buying.SubcontractingOrderController = class SubcontractingOrderControll
var me = this; var me = this;
if (doc.docstatus == 1) { if (doc.docstatus == 1) {
if (doc.status != 'Completed') { if (!['Closed', 'Completed'].includes(doc.status)) {
if (flt(doc.per_received) < 100) { if (flt(doc.per_received) < 100) {
cur_frm.add_custom_button(__('Subcontracting Receipt'), this.make_subcontracting_receipt, __('Create')); cur_frm.add_custom_button(__('Subcontracting Receipt'), this.make_subcontracting_receipt, __('Create'));
if (me.has_unsupplied_items()) { if (me.has_unsupplied_items()) {

View File

@ -153,7 +153,7 @@ class SubcontractingOrder(SubcontractingController):
else: else:
self.set_missing_values() self.set_missing_values()
def update_status(self, status=None, update_modified=False): def update_status(self, status=None, update_modified=True):
if self.docstatus >= 1 and not status: if self.docstatus >= 1 and not status:
if self.docstatus == 1: if self.docstatus == 1:
if self.status == "Draft": if self.status == "Draft":
@ -162,6 +162,10 @@ class SubcontractingOrder(SubcontractingController):
status = "Completed" status = "Completed"
elif self.per_received > 0 and self.per_received < 100: elif self.per_received > 0 and self.per_received < 100:
status = "Partially Received" status = "Partially Received"
for item in self.supplied_items:
if item.returned_qty:
status = "Closed"
break
else: else:
total_required_qty = total_supplied_qty = 0 total_required_qty = total_supplied_qty = 0
for item in self.supplied_items: for item in self.supplied_items:
@ -176,7 +180,10 @@ class SubcontractingOrder(SubcontractingController):
elif self.docstatus == 2: elif self.docstatus == 2:
status = "Cancelled" status = "Cancelled"
frappe.db.set_value("Subcontracting Order", self.name, "status", status, update_modified) if status:
frappe.db.set_value(
"Subcontracting Order", self.name, "status", status, update_modified=update_modified
)
@frappe.whitelist() @frappe.whitelist()

View File

@ -10,6 +10,7 @@ frappe.listview_settings['Subcontracting Order'] = {
"Completed": "green", "Completed": "green",
"Partial Material Transferred": "purple", "Partial Material Transferred": "purple",
"Material Transferred": "blue", "Material Transferred": "blue",
"Closed": "red",
}; };
return [__(doc.status), status_colors[doc.status], "status,=," + doc.status]; return [__(doc.status), status_colors[doc.status], "status,=," + doc.status];
}, },

View File

@ -7,7 +7,10 @@ import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests.utils import FrappeTestCase
from erpnext.buying.doctype.purchase_order.purchase_order import get_mapped_subcontracting_order from erpnext.buying.doctype.purchase_order.purchase_order import get_mapped_subcontracting_order
from erpnext.controllers.subcontracting_controller import make_rm_stock_entry from erpnext.controllers.subcontracting_controller import (
get_materials_from_supplier,
make_rm_stock_entry,
)
from erpnext.controllers.tests.test_subcontracting_controller import ( from erpnext.controllers.tests.test_subcontracting_controller import (
get_rm_items, get_rm_items,
get_subcontracting_order, get_subcontracting_order,
@ -89,6 +92,16 @@ class TestSubcontractingOrder(FrappeTestCase):
sco.load_from_db() sco.load_from_db()
self.assertEqual(sco.status, "Partially Received") self.assertEqual(sco.status, "Partially Received")
# Closed
ste = get_materials_from_supplier(sco.name, [d.name for d in sco.supplied_items])
ste.save()
ste.submit()
sco.load_from_db()
self.assertEqual(sco.status, "Closed")
ste.cancel()
sco.load_from_db()
self.assertEqual(sco.status, "Partially Received")
# Completed # Completed
scr = make_subcontracting_receipt(sco.name) scr = make_subcontracting_receipt(sco.name)
scr.save() scr.save()

View File

@ -150,8 +150,7 @@
"label": "Returned Qty", "label": "Returned Qty",
"no_copy": 1, "no_copy": 1,
"print_hide": 1, "print_hide": 1,
"read_only": 1, "read_only": 1
"hidden": 1
}, },
{ {
"fieldname": "total_supplied_qty", "fieldname": "total_supplied_qty",
@ -166,7 +165,7 @@
"hide_toolbar": 1, "hide_toolbar": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2022-04-07 12:58:28.208847", "modified": "2022-08-26 16:04:56.125951",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Subcontracting", "module": "Subcontracting",
"name": "Subcontracting Order Supplied Item", "name": "Subcontracting Order Supplied Item",

View File

@ -369,7 +369,7 @@
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Status", "label": "Status",
"no_copy": 1, "no_copy": 1,
"options": "\nDraft\nCompleted\nReturn\nReturn Issued\nCancelled", "options": "\nDraft\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed",
"print_hide": 1, "print_hide": 1,
"print_width": "150px", "print_width": "150px",
"read_only": 1, "read_only": 1,
@ -628,7 +628,7 @@
"in_create": 1, "in_create": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2022-08-22 17:30:40.827517", "modified": "2022-08-26 21:02:26.353870",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Subcontracting", "module": "Subcontracting",
"name": "Subcontracting Receipt", "name": "Subcontracting Receipt",