mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 13:39:18 +00:00
Merge branch 'develop' into subcontracting
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.listview_settings['Subcontracting Order'] = {
|
||||
get_indicator: function (doc) {
|
||||
const status_colors = {
|
||||
"Draft": "grey",
|
||||
"Open": "orange",
|
||||
"Partially Received": "yellow",
|
||||
"Completed": "green",
|
||||
"Partial Material Transferred": "purple",
|
||||
"Material Transferred": "blue",
|
||||
};
|
||||
return [__(doc.status), status_colors[doc.status], "status,=," + doc.status];
|
||||
},
|
||||
get_indicator: function (doc) {
|
||||
const status_colors = {
|
||||
"Draft": "grey",
|
||||
"Open": "orange",
|
||||
"Partially Received": "yellow",
|
||||
"Completed": "green",
|
||||
"Partial Material Transferred": "purple",
|
||||
"Material Transferred": "blue",
|
||||
};
|
||||
return [__(doc.status), status_colors[doc.status], "status,=," + doc.status];
|
||||
},
|
||||
};
|
||||
@@ -527,4 +527,4 @@ def create_subcontracting_order(**args):
|
||||
if not args.do_not_submit:
|
||||
sco.submit()
|
||||
|
||||
return sco
|
||||
return sco
|
||||
|
||||
@@ -77,7 +77,7 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
||||
}
|
||||
|
||||
if (!frm.doc.is_return && frm.doc.docstatus == 1 && frm.doc.per_returned < 100) {
|
||||
frm.add_custom_button('Subcontract Return', function () {
|
||||
frm.add_custom_button(__('Subcontract Return'), function () {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: 'erpnext.subcontracting.doctype.subcontracting_receipt.subcontracting_receipt.make_subcontract_return',
|
||||
frm: frm
|
||||
@@ -107,7 +107,7 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
||||
per_received: ["<", 100],
|
||||
company: frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
}, __("Get Items From"));
|
||||
}
|
||||
},
|
||||
@@ -144,7 +144,7 @@ frappe.ui.form.on('Subcontracting Receipt Supplied Item', {
|
||||
let set_warehouse_in_children = (child_table, warehouse_field, warehouse) => {
|
||||
let transaction_controller = new erpnext.TransactionController();
|
||||
transaction_controller.autofill_warehouse(child_table, warehouse_field, warehouse);
|
||||
}
|
||||
};
|
||||
|
||||
let set_missing_values = (frm) => {
|
||||
frappe.call({
|
||||
|
||||
@@ -25,7 +25,7 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
"overflow_type": "receipt",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def update_status_updater_args(self):
|
||||
if cint(self.is_return):
|
||||
self.status_updater.extend(
|
||||
@@ -117,7 +117,7 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
rm_supp_cost[item.reference_name] += item.amount
|
||||
else:
|
||||
rm_supp_cost[item.reference_name] = item.amount
|
||||
|
||||
|
||||
total_qty = total_amount = 0
|
||||
for item in self.items:
|
||||
if item.name in rm_supp_cost:
|
||||
@@ -126,8 +126,10 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
rm_supp_cost.pop(item.name)
|
||||
|
||||
if self.is_new() and item.rm_supp_cost > 0:
|
||||
item.rate = item.rm_cost_per_qty + (item.service_cost_per_qty or 0) + item.additional_cost_per_qty
|
||||
|
||||
item.rate = (
|
||||
item.rm_cost_per_qty + (item.service_cost_per_qty or 0) + item.additional_cost_per_qty
|
||||
)
|
||||
|
||||
item.received_qty = item.qty + (item.rejected_qty or 0)
|
||||
item.amount = item.qty * item.rate
|
||||
total_qty += item.qty
|
||||
@@ -194,4 +196,4 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
def make_subcontract_return(source_name, target_doc=None):
|
||||
from erpnext.controllers.sales_and_purchase_return import make_return_doc
|
||||
|
||||
return make_return_doc("Subcontracting Receipt", source_name, target_doc)
|
||||
return make_return_doc("Subcontracting Receipt", source_name, target_doc)
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.listview_settings['Subcontracting Receipt'] = {
|
||||
get_indicator: function (doc) {
|
||||
const status_colors = {
|
||||
"Draft": "grey",
|
||||
"Return": "gray",
|
||||
"Return Issued": "grey",
|
||||
"Completed": "green",
|
||||
};
|
||||
return [__(doc.status), status_colors[doc.status], "status,=," + doc.status];
|
||||
},
|
||||
};
|
||||
get_indicator: function (doc) {
|
||||
const status_colors = {
|
||||
"Draft": "grey",
|
||||
"Return": "gray",
|
||||
"Return Issued": "grey",
|
||||
"Completed": "green",
|
||||
};
|
||||
return [__(doc.status), status_colors[doc.status], "status,=," + doc.status];
|
||||
},
|
||||
};
|
||||
@@ -8,6 +8,7 @@ import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
from frappe.utils import flt
|
||||
|
||||
from erpnext.controllers.sales_and_purchase_return import make_return_doc
|
||||
from erpnext.controllers.tests.test_subcontracting_controller import (
|
||||
get_rm_items,
|
||||
get_subcontracting_order,
|
||||
@@ -21,9 +22,10 @@ from erpnext.controllers.tests.test_subcontracting_controller import (
|
||||
set_backflush_based_on,
|
||||
)
|
||||
from erpnext.stock.doctype.item.test_item import make_item
|
||||
from erpnext.controllers.sales_and_purchase_return import make_return_doc
|
||||
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
|
||||
from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import make_subcontracting_receipt
|
||||
from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import (
|
||||
make_subcontracting_receipt,
|
||||
)
|
||||
|
||||
|
||||
class TestSubcontractingReceipt(FrappeTestCase):
|
||||
@@ -107,7 +109,7 @@ class TestSubcontractingReceipt(FrappeTestCase):
|
||||
scr = make_subcontracting_receipt(sco.name)
|
||||
scr.save()
|
||||
scr.submit()
|
||||
|
||||
|
||||
gl_entries = get_gl_entries("Subcontracting Receipt", scr.name)
|
||||
self.assertFalse(gl_entries)
|
||||
|
||||
@@ -311,6 +313,7 @@ class TestSubcontractingReceipt(FrappeTestCase):
|
||||
scr1.submit()
|
||||
|
||||
from erpnext.controllers.status_updater import OverAllowanceError
|
||||
|
||||
args = frappe._dict(scr_name=scr1.name, qty=-15)
|
||||
self.assertRaises(OverAllowanceError, make_return_subcontracting_receipt, **args)
|
||||
|
||||
@@ -318,20 +321,23 @@ class TestSubcontractingReceipt(FrappeTestCase):
|
||||
def make_return_subcontracting_receipt(**args):
|
||||
args = frappe._dict(args)
|
||||
return_doc = make_return_doc("Subcontracting Receipt", args.scr_name)
|
||||
return_doc.supplier_warehouse = args.supplier_warehouse or args.warehouse or "_Test Warehouse 1 - _TC"
|
||||
|
||||
return_doc.supplier_warehouse = (
|
||||
args.supplier_warehouse or args.warehouse or "_Test Warehouse 1 - _TC"
|
||||
)
|
||||
|
||||
if args.qty:
|
||||
for item in return_doc.items:
|
||||
item.qty = args.qty
|
||||
|
||||
|
||||
if not args.do_not_save:
|
||||
return_doc.save()
|
||||
if not args.do_not_submit:
|
||||
return_doc.submit()
|
||||
|
||||
|
||||
return_doc.load_from_db()
|
||||
return return_doc
|
||||
|
||||
|
||||
def get_items(**args):
|
||||
args = frappe._dict(args)
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user