Merge pull request #30528 from s-aga-r/is-subcontracted-fieldtype

refactor!: change "is_subcontracted" field type from "Select" to "Check"
This commit is contained in:
Ankush Menat 2022-04-04 14:01:20 +05:30 committed by GitHub
commit 52eb0a93bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 121 additions and 101 deletions

View File

@ -141,7 +141,7 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
})
}, __("Get Items From"));
}
this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted==="Yes");
this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted);
if (doc.docstatus == 1 && !doc.inter_company_invoice_reference) {
frappe.model.with_doc("Supplier", me.frm.doc.supplier, function() {
@ -571,10 +571,10 @@ frappe.ui.form.on("Purchase Invoice", {
},
is_subcontracted: function(frm) {
if (frm.doc.is_subcontracted === "Yes") {
if (frm.doc.is_subcontracted) {
erpnext.buying.get_default_bom(frm);
}
frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes");
frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted);
},
update_stock: function(frm) {

View File

@ -543,11 +543,10 @@
"fieldtype": "Column Break"
},
{
"default": "No",
"default": "0",
"fieldname": "is_subcontracted",
"fieldtype": "Select",
"label": "Raw Materials Supplied",
"options": "No\nYes",
"fieldtype": "Check",
"label": "Is Subcontracted",
"print_hide": 1
},
{
@ -1366,7 +1365,7 @@
"width": "50px"
},
{
"depends_on": "eval:doc.update_stock && doc.is_subcontracted==\"Yes\"",
"depends_on": "eval:doc.update_stock && doc.is_subcontracted",
"fieldname": "supplier_warehouse",
"fieldtype": "Link",
"label": "Supplier Warehouse",

View File

@ -901,7 +901,7 @@ class TestPurchaseInvoice(unittest.TestCase):
)
pi = make_purchase_invoice(
item_code="_Test FG Item", qty=10, rate=500, update_stock=1, is_subcontracted="Yes"
item_code="_Test FG Item", qty=10, rate=500, update_stock=1, is_subcontracted=1
)
self.assertEqual(len(pi.get("supplied_items")), 2)
@ -1611,7 +1611,7 @@ def make_purchase_invoice(**args):
pi.conversion_rate = args.conversion_rate or 1
pi.is_return = args.is_return
pi.return_against = args.return_against
pi.is_subcontracted = args.is_subcontracted or "No"
pi.is_subcontracted = args.is_subcontracted or 0
pi.supplier_warehouse = args.supplier_warehouse or "_Test Warehouse 1 - _TC"
pi.cost_center = args.parent_cost_center
@ -1674,7 +1674,7 @@ def make_purchase_invoice_against_cost_center(**args):
pi.is_return = args.is_return
pi.is_return = args.is_return
pi.credit_to = args.return_against or "Creditors - _TC"
pi.is_subcontracted = args.is_subcontracted or "No"
pi.is_subcontracted = args.is_subcontracted or 0
if args.supplier_warehouse:
pi.supplier_warehouse = "_Test Warehouse 1 - _TC"

View File

@ -623,7 +623,7 @@
},
{
"default": "0",
"depends_on": "eval:parent.is_subcontracted == 'Yes'",
"depends_on": "eval:parent.is_subcontracted",
"fieldname": "include_exploded_items",
"fieldtype": "Check",
"label": "Include Exploded Items",

View File

@ -302,7 +302,7 @@
"is_opening": "No",
"is_paid": 0,
"is_return": 0,
"is_subcontracted": "No",
"is_subcontracted": 0,
"items": [
{
"allow_zero_valuation_rate": 0,

View File

@ -179,7 +179,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
if (doc.status != "On Hold") {
if(flt(doc.per_received) < 100 && allow_receipt) {
cur_frm.add_custom_button(__('Purchase Receipt'), this.make_purchase_receipt, __('Create'));
if(doc.is_subcontracted==="Yes" && me.has_unsupplied_items()) {
if(doc.is_subcontracted && me.has_unsupplied_items()) {
cur_frm.add_custom_button(__('Material to Supplier'),
function() { me.make_stock_entry(); }, __("Transfer"));
}
@ -636,7 +636,7 @@ function set_schedule_date(frm) {
frappe.provide("erpnext.buying");
frappe.ui.form.on("Purchase Order", "is_subcontracted", function(frm) {
if (frm.doc.is_subcontracted === "Yes") {
if (frm.doc.is_subcontracted) {
erpnext.buying.get_default_bom(frm);
}
});

View File

@ -457,16 +457,15 @@
"fieldtype": "Column Break"
},
{
"default": "No",
"default": "0",
"fieldname": "is_subcontracted",
"fieldtype": "Select",
"fieldtype": "Check",
"in_standard_filter": 1,
"label": "Supply Raw Materials",
"options": "No\nYes",
"label": "Is Subcontracted",
"print_hide": 1
},
{
"depends_on": "eval:doc.is_subcontracted==\"Yes\"",
"depends_on": "eval:doc.is_subcontracted",
"fieldname": "supplier_warehouse",
"fieldtype": "Link",
"label": "Supplier Warehouse",

View File

@ -194,7 +194,7 @@ class PurchaseOrder(BuyingController):
)
def validate_bom_for_subcontracting_items(self):
if self.is_subcontracted == "Yes":
if self.is_subcontracted:
for item in self.items:
if not item.bom:
frappe.throw(
@ -294,7 +294,7 @@ class PurchaseOrder(BuyingController):
self.set_status(update=True, status=status)
self.update_requested_qty()
self.update_ordered_qty()
if self.is_subcontracted == "Yes":
if self.is_subcontracted:
self.update_reserved_qty_for_subcontract()
self.notify_update()
@ -311,7 +311,7 @@ class PurchaseOrder(BuyingController):
self.update_ordered_qty()
self.validate_budget()
if self.is_subcontracted == "Yes":
if self.is_subcontracted:
self.update_reserved_qty_for_subcontract()
frappe.get_doc("Authorization Control").validate_approving_authority(
@ -331,7 +331,7 @@ class PurchaseOrder(BuyingController):
if self.has_drop_ship_item():
self.update_delivered_qty_in_sales_order()
if self.is_subcontracted == "Yes":
if self.is_subcontracted:
self.update_reserved_qty_for_subcontract()
self.check_on_hold_or_closed_status()

View File

@ -390,7 +390,7 @@ class TestPurchaseOrder(FrappeTestCase):
frappe.get_doc("Item Tax Template", "Test Update Items Template - _TC").delete()
def test_update_child_uom_conv_factor_change(self):
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted=1)
total_reqd_qty = sum([d.get("required_qty") for d in po.as_dict().get("supplied_items")])
trans_item = json.dumps(
@ -573,7 +573,7 @@ class TestPurchaseOrder(FrappeTestCase):
automatically_fetch_payment_terms(enable=0)
def test_subcontracting(self):
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted=1)
self.assertEqual(len(po.get("supplied_items")), 2)
def test_warehouse_company_validation(self):
@ -617,7 +617,7 @@ class TestPurchaseOrder(FrappeTestCase):
"doctype": "Purchase Order",
"company": "_Test Company",
"supplier": "_Test Supplier",
"is_subcontracted": "No",
"is_subcontracted": 0,
"schedule_date": add_days(nowdate(), 1),
"currency": frappe.get_cached_value("Company", "_Test Company", "default_currency"),
"conversion_factor": 1,
@ -764,7 +764,7 @@ class TestPurchaseOrder(FrappeTestCase):
)
# Submit PO
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted=1)
bin2 = frappe.db.get_value(
"Bin",
@ -919,7 +919,7 @@ class TestPurchaseOrder(FrappeTestCase):
po = create_purchase_order(
item_code=item_code,
qty=1,
is_subcontracted="Yes",
is_subcontracted=1,
supplier_warehouse="_Test Warehouse 1 - _TC",
include_exploded_items=1,
)
@ -936,7 +936,7 @@ class TestPurchaseOrder(FrappeTestCase):
po1 = create_purchase_order(
item_code=item_code,
qty=1,
is_subcontracted="Yes",
is_subcontracted=1,
supplier_warehouse="_Test Warehouse 1 - _TC",
include_exploded_items=0,
)
@ -957,7 +957,7 @@ class TestPurchaseOrder(FrappeTestCase):
po = create_purchase_order(
item_code=item_code,
qty=order_qty,
is_subcontracted="Yes",
is_subcontracted=1,
supplier_warehouse="_Test Warehouse 1 - _TC",
)
@ -1050,7 +1050,7 @@ class TestPurchaseOrder(FrappeTestCase):
po = create_purchase_order(
item_code=item_code,
qty=order_qty,
is_subcontracted="Yes",
is_subcontracted=1,
supplier_warehouse="_Test Warehouse 1 - _TC",
do_not_save=True,
)
@ -1283,7 +1283,7 @@ def create_purchase_order(**args):
po.schedule_date = add_days(nowdate(), 1)
po.company = args.company or "_Test Company"
po.supplier = args.supplier or "_Test Supplier"
po.is_subcontracted = args.is_subcontracted or "No"
po.is_subcontracted = args.is_subcontracted or 0
po.currency = args.currency or frappe.get_cached_value("Company", po.company, "default_currency")
po.conversion_factor = args.conversion_factor or 1
po.supplier_warehouse = args.supplier_warehouse or None
@ -1309,7 +1309,7 @@ def create_purchase_order(**args):
if not args.do_not_save:
po.insert()
if not args.do_not_submit:
if po.is_subcontracted == "Yes":
if po.is_subcontracted:
supp_items = po.get("supplied_items")
for d in supp_items:
if not d.reserve_warehouse:

View File

@ -8,7 +8,7 @@
"doctype": "Purchase Order",
"base_grand_total": 5000.0,
"grand_total": 5000.0,
"is_subcontracted": "Yes",
"is_subcontracted": 1,
"naming_series": "_T-Purchase Order-",
"base_net_total": 5000.0,
"items": [
@ -42,7 +42,7 @@
"doctype": "Purchase Order",
"base_grand_total": 5000.0,
"grand_total": 5000.0,
"is_subcontracted": "No",
"is_subcontracted": 0,
"naming_series": "_T-Purchase Order-",
"base_net_total": 5000.0,
"items": [

View File

@ -572,7 +572,7 @@
"read_only": 1
},
{
"depends_on": "eval:parent.is_subcontracted == 'Yes'",
"depends_on": "eval:parent.is_subcontracted",
"fieldname": "bom",
"fieldtype": "Link",
"label": "BOM",
@ -581,7 +581,7 @@
},
{
"default": "0",
"depends_on": "eval:parent.is_subcontracted == 'Yes'",
"depends_on": "eval:parent.is_subcontracted",
"fieldname": "include_exploded_items",
"fieldtype": "Check",
"label": "Include Exploded Items",

View File

@ -773,11 +773,10 @@
"fieldtype": "Column Break"
},
{
"default": "No",
"default": "0",
"fieldname": "is_subcontracted",
"fieldtype": "Select",
"fieldtype": "Check",
"label": "Is Subcontracted",
"options": "\nYes\nNo",
"print_hide": 1
},
{

View File

@ -7,7 +7,7 @@
"doctype": "Supplier Quotation",
"base_grand_total": 5000.0,
"grand_total": 5000.0,
"is_subcontracted": "No",
"is_subcontracted": 0,
"naming_series": "_T-Supplier Quotation-",
"base_net_total": 5000.0,
"items": [

View File

@ -35,7 +35,7 @@ frappe.query_reports["Subcontract Order Summary"] = {
return {
filters: {
docstatus: 1,
is_subcontracted: 'Yes',
is_subcontracted: 1,
company: frappe.query_report.get_filter_value('company')
}
}

View File

@ -45,7 +45,7 @@ def get_subcontracted_orders(report_filters):
def get_filters(report_filters):
filters = [
["Purchase Order", "docstatus", "=", 1],
["Purchase Order", "is_subcontracted", "=", "Yes"],
["Purchase Order", "is_subcontracted", "=", 1],
[
"Purchase Order",
"transaction_date",

View File

@ -78,7 +78,7 @@ def get_data(data, filters):
def get_po(filters):
record_filters = [
["is_subcontracted", "=", "Yes"],
["is_subcontracted", "=", 1],
["supplier", "=", filters.supplier],
["transaction_date", "<=", filters.to_date],
["transaction_date", ">=", filters.from_date],

View File

@ -17,7 +17,7 @@ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
class TestSubcontractedItemToBeReceived(FrappeTestCase):
def test_pending_and_received_qty(self):
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted=1)
transfer_param = []
make_stock_entry(
item_code="_Test Item", target="_Test Warehouse 1 - _TC", qty=100, basic_rate=100

View File

@ -72,7 +72,7 @@ def get_po_items_to_supply(filters):
],
filters=[
["Purchase Order", "per_received", "<", "100"],
["Purchase Order", "is_subcontracted", "=", "Yes"],
["Purchase Order", "is_subcontracted", "=", 1],
["Purchase Order", "supplier", "=", filters.supplier],
["Purchase Order", "transaction_date", "<=", filters.to_date],
["Purchase Order", "transaction_date", ">=", filters.from_date],

View File

@ -19,7 +19,7 @@ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
class TestSubcontractedItemToBeTransferred(FrappeTestCase):
def test_pending_and_transferred_qty(self):
po = create_purchase_order(
item_code="_Test FG Item", is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
item_code="_Test FG Item", is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
# Material Receipt of RMs

View File

@ -2586,7 +2586,7 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
parent.update_ordered_qty()
parent.update_ordered_and_reserved_qty()
parent.update_receiving_percentage()
if parent.is_subcontracted == "Yes":
if parent.is_subcontracted:
parent.update_reserved_qty_for_subcontract()
parent.create_raw_materials_supplied("supplied_items")
parent.save()

View File

@ -167,7 +167,7 @@ class BuyingController(StockController, Subcontracting):
_("Row #{0}: Accepted Warehouse and Supplier Warehouse cannot be same").format(item.idx)
)
if item.get("from_warehouse") and self.get("is_subcontracted") == "Yes":
if item.get("from_warehouse") and self.get("is_subcontracted"):
frappe.throw(
_(
"Row #{0}: Cannot select Supplier Warehouse while suppling raw materials to subcontractor"
@ -339,10 +339,7 @@ class BuyingController(StockController, Subcontracting):
return supplied_items_cost
def validate_for_subcontracting(self):
if not self.is_subcontracted and self.sub_contracted_items:
frappe.throw(_("Please enter 'Is Subcontracted' as Yes or No"))
if self.is_subcontracted == "Yes":
if self.is_subcontracted:
if self.doctype in ["Purchase Receipt", "Purchase Invoice"] and not self.supplier_warehouse:
frappe.throw(_("Supplier Warehouse mandatory for sub-contracted {0}").format(self.doctype))
@ -363,14 +360,14 @@ class BuyingController(StockController, Subcontracting):
item.bom = None
def create_raw_materials_supplied(self, raw_material_table):
if self.is_subcontracted == "Yes":
if self.is_subcontracted:
self.set_materials_for_subcontracted_items(raw_material_table)
elif self.doctype in ["Purchase Receipt", "Purchase Invoice"]:
for item in self.get("items"):
item.rm_supp_cost = 0.0
if self.is_subcontracted == "No" and self.get("supplied_items"):
if not self.is_subcontracted and self.get("supplied_items"):
self.set("supplied_items", [])
@property
@ -803,7 +800,7 @@ class BuyingController(StockController, Subcontracting):
if self.doctype == "Material Request":
return
if hasattr(self, "is_subcontracted") and self.is_subcontracted == "Yes":
if hasattr(self, "is_subcontracted") and self.is_subcontracted:
validate_item_type(self, "is_sub_contracted_item", "subcontracted")
else:
validate_item_type(self, "is_purchase_item", "purchase")

View File

@ -407,7 +407,7 @@ class Subcontracting:
def set_consumed_qty_in_po(self):
# Update consumed qty back in the purchase order
if self.is_subcontracted != "Yes":
if not self.is_subcontracted:
return
self.__get_purchase_orders()

View File

@ -251,7 +251,7 @@ class TestBOM(FrappeTestCase):
self.assertEqual(bom.items[2].rate, 0)
# test in Purchase Order sourced_by_supplier is not added to Supplied Item
po = create_purchase_order(
item_code=item_code, qty=1, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
item_code=item_code, qty=1, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
bom_items = sorted([d.item_code for d in bom.items if d.sourced_by_supplier != 1])
supplied_items = sorted([d.rm_item_code for d in po.supplied_items])

View File

@ -501,7 +501,7 @@ class ProductionPlan(Document):
po = frappe.new_doc("Purchase Order")
po.supplier = supplier
po.schedule_date = getdate(po_list[0].schedule_date) if po_list[0].schedule_date else nowdate()
po.is_subcontracted = "Yes"
po.is_subcontracted = 1
for row in po_list:
po_data = {
"item_code": row.production_item,

View File

@ -4,6 +4,7 @@ erpnext.patches.v11_0.rename_production_order_to_work_order
erpnext.patches.v13_0.add_bin_unique_constraint
erpnext.patches.v11_0.refactor_naming_series
erpnext.patches.v11_0.refactor_autoname_naming
erpnext.patches.v14_0.change_is_subcontracted_fieldtype
execute:frappe.reload_doc("accounts", "doctype", "POS Payment Method") #2020-05-28
execute:frappe.reload_doc("HR", "doctype", "HR Settings") #2020-01-16 #2020-07-24
erpnext.patches.v4_2.update_requested_and_ordered_qty #2021-03-31

View File

@ -0,0 +1,26 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import frappe
def execute():
for doctype in ["Purchase Order", "Purchase Receipt", "Purchase Invoice", "Supplier Quotation"]:
frappe.db.sql(
"""
UPDATE `tab{doctype}`
SET is_subcontracted = 0
where is_subcontracted in ('', NULL, 'No')""".format(
doctype=doctype
)
)
frappe.db.sql(
"""
UPDATE `tab{doctype}`
SET is_subcontracted = 1
where is_subcontracted = 'Yes'""".format(
doctype=doctype
)
)
frappe.reload_doc(frappe.get_meta(doctype).module, "doctype", frappe.scrub(doctype))

View File

@ -81,7 +81,7 @@ erpnext.buying.BuyingController = class BuyingController extends erpnext.Transac
}
this.frm.set_query("item_code", "items", function() {
if (me.frm.doc.is_subcontracted == "Yes") {
if (me.frm.doc.is_subcontracted) {
return{
query: "erpnext.controllers.queries.item_query",
filters:{ 'supplier': me.frm.doc.supplier, 'is_sub_contracted_item': 1 }

View File

@ -239,7 +239,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
() => set_value('currency', currency),
() => set_value('price_list_currency', currency),
() => set_value('status', 'Draft'),
() => set_value('is_subcontracted', 'No'),
() => set_value('is_subcontracted', 0),
() => {
if(this.frm.doc.company && !this.frm.doc.amended_from) {
this.frm.trigger("company");

View File

@ -483,7 +483,7 @@ erpnext.utils.update_child_items = function(opts) {
if (frm.doc.doctype == 'Sales Order') {
filters = {"is_sales_item": 1};
} else if (frm.doc.doctype == 'Purchase Order') {
if (frm.doc.is_subcontracted == "Yes") {
if (frm.doc.is_subcontracted) {
filters = {"is_sub_contracted_item": 1};
} else {
filters = {"is_purchase_item": 1};

View File

@ -54,7 +54,7 @@ class Bin(Document):
(supplied_item.rm_item_code == self.item_code)
& (po.name == supplied_item.parent)
& (po.docstatus == 1)
& (po.is_subcontracted == "Yes")
& (po.is_subcontracted)
& (po.status != "Closed")
& (po.per_received < 100)
& (supplied_item.reserve_warehouse == self.warehouse)
@ -79,7 +79,7 @@ class Bin(Document):
& (se.name == se_item.parent)
& (po.name == se.purchase_order)
& (po.docstatus == 1)
& (po.is_subcontracted == "Yes")
& (po.is_subcontracted == 1)
& (po.status != "Closed")
& (po.per_received < 100)
)

View File

@ -41,7 +41,7 @@ class TestItemAlternative(FrappeTestCase):
supplier_warehouse = "Test Supplier Warehouse - _TC"
po = create_purchase_order(
item="Test Finished Goods - A",
is_subcontracted="Yes",
is_subcontracted=1,
qty=5,
rate=3000,
supplier_warehouse=supplier_warehouse,

View File

@ -200,7 +200,7 @@ erpnext.stock.PurchaseReceiptController = class PurchaseReceiptController extend
cur_frm.add_custom_button(__('Reopen'), this.reopen_purchase_receipt, __("Status"))
}
this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted==="Yes");
this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted);
}
make_purchase_invoice() {
@ -298,10 +298,10 @@ cur_frm.fields_dict['items'].grid.get_field('bom').get_query = function(doc, cdt
frappe.provide("erpnext.buying");
frappe.ui.form.on("Purchase Receipt", "is_subcontracted", function(frm) {
if (frm.doc.is_subcontracted === "Yes") {
if (frm.doc.is_subcontracted) {
erpnext.buying.get_default_bom(frm);
}
frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes");
frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted);
});
frappe.ui.form.on('Purchase Receipt Item', {

View File

@ -437,17 +437,16 @@
"fieldtype": "Column Break"
},
{
"default": "No",
"default": "0",
"fieldname": "is_subcontracted",
"fieldtype": "Select",
"label": "Raw Materials Consumed",
"fieldtype": "Check",
"label": "Is Subcontracted",
"oldfieldname": "is_subcontracted",
"oldfieldtype": "Select",
"options": "No\nYes",
"print_hide": 1
},
{
"depends_on": "eval:doc.is_subcontracted==\"Yes\"",
"depends_on": "eval:doc.is_subcontracted",
"fieldname": "supplier_warehouse",
"fieldtype": "Link",
"label": "Supplier Warehouse",

View File

@ -327,7 +327,7 @@ class TestPurchaseReceipt(FrappeTestCase):
target="_Test Warehouse 1 - _TC",
basic_rate=100,
)
pr = make_purchase_receipt(item_code="_Test FG Item", qty=10, rate=500, is_subcontracted="Yes")
pr = make_purchase_receipt(item_code="_Test FG Item", qty=10, rate=500, is_subcontracted=1)
self.assertEqual(len(pr.get("supplied_items")), 2)
rm_supp_cost = sum(d.amount for d in pr.get("supplied_items"))
@ -362,7 +362,7 @@ class TestPurchaseReceipt(FrappeTestCase):
item_code="_Test FG Item",
qty=10,
rate=0,
is_subcontracted="Yes",
is_subcontracted=1,
company="_Test Company with perpetual inventory",
warehouse="Stores - TCP1",
supplier_warehouse="Work In Progress - TCP1",
@ -401,7 +401,7 @@ class TestPurchaseReceipt(FrappeTestCase):
item_code=item_code,
qty=1,
include_exploded_items=0,
is_subcontracted="Yes",
is_subcontracted=1,
supplier_warehouse="_Test Warehouse 1 - _TC",
)
@ -1122,7 +1122,7 @@ class TestPurchaseReceipt(FrappeTestCase):
po = create_purchase_order(
item_code=item_code,
qty=order_qty,
is_subcontracted="Yes",
is_subcontracted=1,
supplier_warehouse="_Test Warehouse 1 - _TC",
)
@ -1465,7 +1465,7 @@ def make_purchase_receipt(**args):
pr.set_posting_time = 1
pr.company = args.company or "_Test Company"
pr.supplier = args.supplier or "_Test Supplier"
pr.is_subcontracted = args.is_subcontracted or "No"
pr.is_subcontracted = args.is_subcontracted or 0
pr.supplier_warehouse = args.supplier_warehouse or "_Test Warehouse 1 - _TC"
pr.currency = args.currency or "INR"
pr.is_return = args.is_return

View File

@ -92,7 +92,7 @@
"currency": "INR",
"doctype": "Purchase Receipt",
"base_grand_total": 5000.0,
"is_subcontracted": "Yes",
"is_subcontracted": 1,
"base_net_total": 5000.0,
"items": [
{

View File

@ -648,7 +648,7 @@
},
{
"default": "0",
"depends_on": "eval:parent.is_subcontracted == 'Yes'",
"depends_on": "eval:parent.is_subcontracted",
"fieldname": "include_exploded_items",
"fieldtype": "Check",
"label": "Include Exploded Items",

View File

@ -778,7 +778,7 @@ erpnext.stock.StockEntry = class StockEntry extends erpnext.stock.StockControlle
return {
"filters": {
"docstatus": 1,
"is_subcontracted": "Yes",
"is_subcontracted": 1,
"company": me.frm.doc.company
}
};

View File

@ -436,7 +436,7 @@ class TestStockLedgerEntry(FrappeTestCase):
item_code=subcontracted_item,
qty=10,
rate=20,
is_subcontracted="Yes",
is_subcontracted=1,
)
self.assertEqual(pr1.items[0].valuation_rate, 120)

View File

@ -50,7 +50,7 @@ def get_item_details(args, doc=None, for_validate=False, overwrite_warehouse=Tru
"transaction_date": None,
"conversion_rate": 1.0,
"buying_price_list": None,
"is_subcontracted": "Yes" / "No",
"is_subcontracted": 0/1,
"ignore_pricing_rule": 0/1
"project": ""
"set_warehouse": ""
@ -124,7 +124,7 @@ def get_item_details(args, doc=None, for_validate=False, overwrite_warehouse=Tru
if args.transaction_date and item.lead_time_days:
out.schedule_date = out.lead_time_date = add_days(args.transaction_date, item.lead_time_days)
if args.get("is_subcontracted") == "Yes":
if args.get("is_subcontracted"):
out.bom = args.get("bom") or get_default_bom(args.item_code)
get_gross_profit(out)
@ -240,7 +240,7 @@ def validate_item_details(args, item):
throw(_("Item {0} is a template, please select one of its variants").format(item.name))
elif args.transaction_type == "buying" and args.doctype != "Material Request":
if args.get("is_subcontracted") == "Yes" and item.is_sub_contracted_item != 1:
if args.get("is_subcontracted") and item.is_sub_contracted_item != 1:
throw(_("Item {0} must be a Sub-contracted Item").format(item.name))
@ -261,7 +261,7 @@ def get_basic_details(args, item, overwrite_warehouse=True):
"transaction_date": None,
"conversion_rate": 1.0,
"buying_price_list": None,
"is_subcontracted": "Yes" / "No",
"is_subcontracted": 0/1,
"ignore_pricing_rule": 0/1
"project": "",
barcode: "",

View File

@ -715,7 +715,7 @@ class update_entries_after(object):
)
# Recalculate subcontracted item's rate in case of subcontracted purchase receipt/invoice
if frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "is_subcontracted") == "Yes":
if frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "is_subcontracted"):
doc = frappe.get_doc(sle.voucher_type, sle.voucher_no)
doc.update_valuation_rate(reset_outgoing_rate=False)
for d in doc.items + doc.supplied_items:

View File

@ -50,7 +50,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -112,7 +112,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -175,7 +175,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -239,7 +239,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -298,7 +298,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -363,7 +363,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -421,7 +421,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -492,7 +492,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -529,7 +529,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -609,7 +609,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -675,7 +675,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -751,7 +751,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items:
@ -834,7 +834,7 @@ class TestSubcontracting(unittest.TestCase):
itemwise_details = make_stock_in_entry(rm_items=rm_items)
po = create_purchase_order(
rm_items=items, is_subcontracted="Yes", supplier_warehouse="_Test Warehouse 1 - _TC"
rm_items=items, is_subcontracted=1, supplier_warehouse="_Test Warehouse 1 - _TC"
)
for d in rm_items: