Merge branch 'develop' into asset_value_adjust_get_depr_amt
This commit is contained in:
commit
edaa0bc3f7
@ -9,15 +9,14 @@
|
|||||||
"production_item_tab",
|
"production_item_tab",
|
||||||
"item",
|
"item",
|
||||||
"company",
|
"company",
|
||||||
"item_name",
|
|
||||||
"uom",
|
"uom",
|
||||||
|
"quantity",
|
||||||
"cb0",
|
"cb0",
|
||||||
"is_active",
|
"is_active",
|
||||||
"is_default",
|
"is_default",
|
||||||
"allow_alternative_item",
|
"allow_alternative_item",
|
||||||
"set_rate_of_sub_assembly_item_based_on_bom",
|
"set_rate_of_sub_assembly_item_based_on_bom",
|
||||||
"project",
|
"project",
|
||||||
"quantity",
|
|
||||||
"image",
|
"image",
|
||||||
"currency_detail",
|
"currency_detail",
|
||||||
"rm_cost_as_per",
|
"rm_cost_as_per",
|
||||||
@ -27,6 +26,8 @@
|
|||||||
"column_break_ivyw",
|
"column_break_ivyw",
|
||||||
"currency",
|
"currency",
|
||||||
"conversion_rate",
|
"conversion_rate",
|
||||||
|
"materials_section",
|
||||||
|
"items",
|
||||||
"section_break_21",
|
"section_break_21",
|
||||||
"operations_section_section",
|
"operations_section_section",
|
||||||
"with_operations",
|
"with_operations",
|
||||||
@ -38,8 +39,6 @@
|
|||||||
"operating_cost_per_bom_quantity",
|
"operating_cost_per_bom_quantity",
|
||||||
"operations_section",
|
"operations_section",
|
||||||
"operations",
|
"operations",
|
||||||
"materials_section",
|
|
||||||
"items",
|
|
||||||
"scrap_section",
|
"scrap_section",
|
||||||
"scrap_items_section",
|
"scrap_items_section",
|
||||||
"scrap_items",
|
"scrap_items",
|
||||||
@ -59,6 +58,7 @@
|
|||||||
"total_cost",
|
"total_cost",
|
||||||
"base_total_cost",
|
"base_total_cost",
|
||||||
"more_info_tab",
|
"more_info_tab",
|
||||||
|
"item_name",
|
||||||
"description",
|
"description",
|
||||||
"column_break_27",
|
"column_break_27",
|
||||||
"has_variants",
|
"has_variants",
|
||||||
@ -192,6 +192,7 @@
|
|||||||
"options": "Quality Inspection Template"
|
"options": "Quality Inspection Template"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"collapsible": 1,
|
||||||
"fieldname": "currency_detail",
|
"fieldname": "currency_detail",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Cost Configuration"
|
"label": "Cost Configuration"
|
||||||
@ -417,7 +418,7 @@
|
|||||||
{
|
{
|
||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
"fieldname": "website_section",
|
"fieldname": "website_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Tab Break",
|
||||||
"label": "Website"
|
"label": "Website"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -482,7 +483,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "section_break_21",
|
"fieldname": "section_break_21",
|
||||||
"fieldtype": "Tab Break",
|
"fieldtype": "Tab Break",
|
||||||
"label": "Operations & Materials"
|
"label": "Operations"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_23",
|
"fieldname": "column_break_23",
|
||||||
@ -605,7 +606,7 @@
|
|||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-02-13 17:31:37.504565",
|
"modified": "2023-04-06 12:47:58.514795",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "BOM",
|
"name": "BOM",
|
||||||
|
|||||||
@ -22,17 +22,13 @@
|
|||||||
"produced_qty",
|
"produced_qty",
|
||||||
"process_loss_qty",
|
"process_loss_qty",
|
||||||
"project",
|
"project",
|
||||||
"serial_no_and_batch_for_finished_good_section",
|
"section_break_ndpq",
|
||||||
"has_serial_no",
|
"required_items",
|
||||||
"has_batch_no",
|
|
||||||
"column_break_17",
|
|
||||||
"serial_no",
|
|
||||||
"batch_size",
|
|
||||||
"work_order_configuration",
|
"work_order_configuration",
|
||||||
"settings_section",
|
"settings_section",
|
||||||
"allow_alternative_item",
|
"allow_alternative_item",
|
||||||
"use_multi_level_bom",
|
"use_multi_level_bom",
|
||||||
"column_break_18",
|
"column_break_17",
|
||||||
"skip_transfer",
|
"skip_transfer",
|
||||||
"from_wip_warehouse",
|
"from_wip_warehouse",
|
||||||
"update_consumed_material_cost_in_project",
|
"update_consumed_material_cost_in_project",
|
||||||
@ -42,9 +38,14 @@
|
|||||||
"column_break_12",
|
"column_break_12",
|
||||||
"fg_warehouse",
|
"fg_warehouse",
|
||||||
"scrap_warehouse",
|
"scrap_warehouse",
|
||||||
|
"serial_no_and_batch_for_finished_good_section",
|
||||||
|
"has_serial_no",
|
||||||
|
"has_batch_no",
|
||||||
|
"column_break_18",
|
||||||
|
"serial_no",
|
||||||
|
"batch_size",
|
||||||
"required_items_section",
|
"required_items_section",
|
||||||
"materials_and_operations_tab",
|
"materials_and_operations_tab",
|
||||||
"required_items",
|
|
||||||
"operations_section",
|
"operations_section",
|
||||||
"operations",
|
"operations",
|
||||||
"transfer_material_against",
|
"transfer_material_against",
|
||||||
@ -586,7 +587,11 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "materials_and_operations_tab",
|
"fieldname": "materials_and_operations_tab",
|
||||||
"fieldtype": "Tab Break",
|
"fieldtype": "Tab Break",
|
||||||
"label": "Materials & Operations"
|
"label": "Operations"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "section_break_ndpq",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-cogs",
|
"icon": "fa fa-cogs",
|
||||||
@ -594,7 +599,7 @@
|
|||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-01-03 14:16:35.427731",
|
"modified": "2023-04-06 12:35:12.149827",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Work Order",
|
"name": "Work Order",
|
||||||
|
|||||||
@ -83,6 +83,8 @@
|
|||||||
"actual_qty",
|
"actual_qty",
|
||||||
"installed_qty",
|
"installed_qty",
|
||||||
"item_tax_rate",
|
"item_tax_rate",
|
||||||
|
"column_break_atna",
|
||||||
|
"received_qty",
|
||||||
"accounting_details_section",
|
"accounting_details_section",
|
||||||
"expense_account",
|
"expense_account",
|
||||||
"allow_zero_valuation_rate",
|
"allow_zero_valuation_rate",
|
||||||
@ -832,13 +834,27 @@
|
|||||||
"fieldname": "material_request_item",
|
"fieldname": "material_request_item",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Material Request Item"
|
"label": "Material Request Item"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_atna",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval: parent.is_internal_customer",
|
||||||
|
"fieldname": "received_qty",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"label": "Received Qty",
|
||||||
|
"no_copy": 1,
|
||||||
|
"print_hide": 1,
|
||||||
|
"read_only": 1,
|
||||||
|
"report_hide": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-03-20 14:24:10.406746",
|
"modified": "2023-04-06 09:28:29.182053",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Delivery Note Item",
|
"name": "Delivery Note Item",
|
||||||
|
|||||||
@ -65,6 +65,16 @@ class PurchaseReceipt(BuyingController):
|
|||||||
"percent_join_field": "purchase_invoice",
|
"percent_join_field": "purchase_invoice",
|
||||||
"overflow_type": "receipt",
|
"overflow_type": "receipt",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"source_dt": "Purchase Receipt Item",
|
||||||
|
"target_dt": "Delivery Note Item",
|
||||||
|
"join_field": "delivery_note_item",
|
||||||
|
"source_field": "received_qty",
|
||||||
|
"target_field": "received_qty",
|
||||||
|
"target_parent_dt": "Delivery Note",
|
||||||
|
"target_ref_field": "qty",
|
||||||
|
"overflow_type": "receipt",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
if cint(self.is_return):
|
if cint(self.is_return):
|
||||||
|
|||||||
@ -1544,6 +1544,72 @@ class TestPurchaseReceipt(FrappeTestCase):
|
|||||||
res = get_item_details(args)
|
res = get_item_details(args)
|
||||||
self.assertEqual(res.get("last_purchase_rate"), 100)
|
self.assertEqual(res.get("last_purchase_rate"), 100)
|
||||||
|
|
||||||
|
def test_validate_received_qty_for_internal_pr(self):
|
||||||
|
prepare_data_for_internal_transfer()
|
||||||
|
customer = "_Test Internal Customer 2"
|
||||||
|
company = "_Test Company with perpetual inventory"
|
||||||
|
from_warehouse = create_warehouse("_Test Internal From Warehouse New", company=company)
|
||||||
|
target_warehouse = create_warehouse("_Test Internal GIT Warehouse New", company=company)
|
||||||
|
to_warehouse = create_warehouse("_Test Internal To Warehouse New", company=company)
|
||||||
|
|
||||||
|
# Step 1: Create Item
|
||||||
|
item = make_item(properties={"is_stock_item": 1, "valuation_rate": 100})
|
||||||
|
|
||||||
|
# Step 2: Create Stock Entry (Material Receipt)
|
||||||
|
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
|
||||||
|
|
||||||
|
make_stock_entry(
|
||||||
|
purpose="Material Receipt",
|
||||||
|
item_code=item.name,
|
||||||
|
qty=15,
|
||||||
|
company=company,
|
||||||
|
to_warehouse=from_warehouse,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Step 3: Create Delivery Note with Internal Customer
|
||||||
|
from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
|
||||||
|
|
||||||
|
dn = create_delivery_note(
|
||||||
|
item_code=item.name,
|
||||||
|
company=company,
|
||||||
|
customer=customer,
|
||||||
|
cost_center="Main - TCP1",
|
||||||
|
expense_account="Cost of Goods Sold - TCP1",
|
||||||
|
qty=10,
|
||||||
|
rate=100,
|
||||||
|
warehouse=from_warehouse,
|
||||||
|
target_warehouse=target_warehouse,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Step 4: Create Internal Purchase Receipt
|
||||||
|
from erpnext.controllers.status_updater import OverAllowanceError
|
||||||
|
from erpnext.stock.doctype.delivery_note.delivery_note import make_inter_company_purchase_receipt
|
||||||
|
|
||||||
|
pr = make_inter_company_purchase_receipt(dn.name)
|
||||||
|
pr.items[0].qty = 15
|
||||||
|
pr.items[0].from_warehouse = target_warehouse
|
||||||
|
pr.items[0].warehouse = to_warehouse
|
||||||
|
pr.items[0].rejected_warehouse = from_warehouse
|
||||||
|
pr.save()
|
||||||
|
|
||||||
|
self.assertRaises(OverAllowanceError, pr.submit)
|
||||||
|
|
||||||
|
# Step 5: Test Over Receipt Allowance
|
||||||
|
frappe.db.set_single_value("Stock Settings", "over_delivery_receipt_allowance", 50)
|
||||||
|
|
||||||
|
make_stock_entry(
|
||||||
|
purpose="Material Transfer",
|
||||||
|
item_code=item.name,
|
||||||
|
qty=5,
|
||||||
|
company=company,
|
||||||
|
from_warehouse=from_warehouse,
|
||||||
|
to_warehouse=target_warehouse,
|
||||||
|
)
|
||||||
|
|
||||||
|
pr.submit()
|
||||||
|
|
||||||
|
frappe.db.set_single_value("Stock Settings", "over_delivery_receipt_allowance", 0)
|
||||||
|
|
||||||
|
|
||||||
def prepare_data_for_internal_transfer():
|
def prepare_data_for_internal_transfer():
|
||||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier
|
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier
|
||||||
|
|||||||
@ -27,7 +27,6 @@
|
|||||||
"set_posting_time",
|
"set_posting_time",
|
||||||
"inspection_required",
|
"inspection_required",
|
||||||
"apply_putaway_rule",
|
"apply_putaway_rule",
|
||||||
"items_tab",
|
|
||||||
"bom_info_section",
|
"bom_info_section",
|
||||||
"from_bom",
|
"from_bom",
|
||||||
"use_multi_level_bom",
|
"use_multi_level_bom",
|
||||||
@ -256,7 +255,7 @@
|
|||||||
"description": "As per Stock UOM",
|
"description": "As per Stock UOM",
|
||||||
"fieldname": "fg_completed_qty",
|
"fieldname": "fg_completed_qty",
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"label": "For Quantity",
|
"label": "Finished Good Quantity ",
|
||||||
"oldfieldname": "fg_completed_qty",
|
"oldfieldname": "fg_completed_qty",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
@ -612,11 +611,7 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "items_tab",
|
"collapsible": 1,
|
||||||
"fieldtype": "Tab Break",
|
|
||||||
"label": "Items"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "bom_info_section",
|
"fieldname": "bom_info_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "BOM Info"
|
"label": "BOM Info"
|
||||||
@ -644,8 +639,10 @@
|
|||||||
"oldfieldtype": "Section Break"
|
"oldfieldtype": "Section Break"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"collapsible": 1,
|
||||||
"fieldname": "section_break_7qsm",
|
"fieldname": "section_break_7qsm",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Process Loss"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "process_loss_percentage",
|
"depends_on": "process_loss_percentage",
|
||||||
@ -677,7 +674,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-01-03 16:02:50.741816",
|
"modified": "2023-04-06 12:42:56.673180",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Entry",
|
"name": "Stock Entry",
|
||||||
|
|||||||
@ -245,17 +245,17 @@ class SubcontractingReceipt(SubcontractingController):
|
|||||||
item.expense_account = expense_account
|
item.expense_account = expense_account
|
||||||
|
|
||||||
def update_status(self, status=None, update_modified=False):
|
def update_status(self, status=None, update_modified=False):
|
||||||
if self.docstatus >= 1 and not status:
|
if not status:
|
||||||
if self.docstatus == 1:
|
if self.docstatus == 0:
|
||||||
|
status = "Draft"
|
||||||
|
elif self.docstatus == 1:
|
||||||
|
status = "Completed"
|
||||||
if self.is_return:
|
if self.is_return:
|
||||||
status = "Return"
|
status = "Return"
|
||||||
return_against = frappe.get_doc("Subcontracting Receipt", self.return_against)
|
return_against = frappe.get_doc("Subcontracting Receipt", self.return_against)
|
||||||
return_against.run_method("update_status")
|
return_against.run_method("update_status")
|
||||||
else:
|
elif self.per_returned == 100:
|
||||||
if self.per_returned == 100:
|
|
||||||
status = "Return Issued"
|
status = "Return Issued"
|
||||||
elif self.status == "Draft":
|
|
||||||
status = "Completed"
|
|
||||||
elif self.docstatus == 2:
|
elif self.docstatus == 2:
|
||||||
status = "Cancelled"
|
status = "Cancelled"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user