Merge branch 'develop' into asset_value_adjust_get_depr_amt
This commit is contained in:
commit
edaa0bc3f7
@ -9,15 +9,14 @@
|
||||
"production_item_tab",
|
||||
"item",
|
||||
"company",
|
||||
"item_name",
|
||||
"uom",
|
||||
"quantity",
|
||||
"cb0",
|
||||
"is_active",
|
||||
"is_default",
|
||||
"allow_alternative_item",
|
||||
"set_rate_of_sub_assembly_item_based_on_bom",
|
||||
"project",
|
||||
"quantity",
|
||||
"image",
|
||||
"currency_detail",
|
||||
"rm_cost_as_per",
|
||||
@ -27,6 +26,8 @@
|
||||
"column_break_ivyw",
|
||||
"currency",
|
||||
"conversion_rate",
|
||||
"materials_section",
|
||||
"items",
|
||||
"section_break_21",
|
||||
"operations_section_section",
|
||||
"with_operations",
|
||||
@ -38,8 +39,6 @@
|
||||
"operating_cost_per_bom_quantity",
|
||||
"operations_section",
|
||||
"operations",
|
||||
"materials_section",
|
||||
"items",
|
||||
"scrap_section",
|
||||
"scrap_items_section",
|
||||
"scrap_items",
|
||||
@ -59,6 +58,7 @@
|
||||
"total_cost",
|
||||
"base_total_cost",
|
||||
"more_info_tab",
|
||||
"item_name",
|
||||
"description",
|
||||
"column_break_27",
|
||||
"has_variants",
|
||||
@ -192,6 +192,7 @@
|
||||
"options": "Quality Inspection Template"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "currency_detail",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Cost Configuration"
|
||||
@ -417,7 +418,7 @@
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "website_section",
|
||||
"fieldtype": "Section Break",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Website"
|
||||
},
|
||||
{
|
||||
@ -482,7 +483,7 @@
|
||||
{
|
||||
"fieldname": "section_break_21",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Operations & Materials"
|
||||
"label": "Operations"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_23",
|
||||
@ -605,7 +606,7 @@
|
||||
"image_field": "image",
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-02-13 17:31:37.504565",
|
||||
"modified": "2023-04-06 12:47:58.514795",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "BOM",
|
||||
|
@ -22,17 +22,13 @@
|
||||
"produced_qty",
|
||||
"process_loss_qty",
|
||||
"project",
|
||||
"serial_no_and_batch_for_finished_good_section",
|
||||
"has_serial_no",
|
||||
"has_batch_no",
|
||||
"column_break_17",
|
||||
"serial_no",
|
||||
"batch_size",
|
||||
"section_break_ndpq",
|
||||
"required_items",
|
||||
"work_order_configuration",
|
||||
"settings_section",
|
||||
"allow_alternative_item",
|
||||
"use_multi_level_bom",
|
||||
"column_break_18",
|
||||
"column_break_17",
|
||||
"skip_transfer",
|
||||
"from_wip_warehouse",
|
||||
"update_consumed_material_cost_in_project",
|
||||
@ -42,9 +38,14 @@
|
||||
"column_break_12",
|
||||
"fg_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",
|
||||
"materials_and_operations_tab",
|
||||
"required_items",
|
||||
"operations_section",
|
||||
"operations",
|
||||
"transfer_material_against",
|
||||
@ -586,7 +587,11 @@
|
||||
{
|
||||
"fieldname": "materials_and_operations_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Materials & Operations"
|
||||
"label": "Operations"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_ndpq",
|
||||
"fieldtype": "Section Break"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-cogs",
|
||||
@ -594,7 +599,7 @@
|
||||
"image_field": "image",
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-01-03 14:16:35.427731",
|
||||
"modified": "2023-04-06 12:35:12.149827",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Work Order",
|
||||
|
@ -83,6 +83,8 @@
|
||||
"actual_qty",
|
||||
"installed_qty",
|
||||
"item_tax_rate",
|
||||
"column_break_atna",
|
||||
"received_qty",
|
||||
"accounting_details_section",
|
||||
"expense_account",
|
||||
"allow_zero_valuation_rate",
|
||||
@ -832,13 +834,27 @@
|
||||
"fieldname": "material_request_item",
|
||||
"fieldtype": "Data",
|
||||
"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,
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-03-20 14:24:10.406746",
|
||||
"modified": "2023-04-06 09:28:29.182053",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Delivery Note Item",
|
||||
|
@ -65,6 +65,16 @@ class PurchaseReceipt(BuyingController):
|
||||
"percent_join_field": "purchase_invoice",
|
||||
"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):
|
||||
|
@ -1544,6 +1544,72 @@ class TestPurchaseReceipt(FrappeTestCase):
|
||||
res = get_item_details(args)
|
||||
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():
|
||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_internal_supplier
|
||||
|
@ -27,7 +27,6 @@
|
||||
"set_posting_time",
|
||||
"inspection_required",
|
||||
"apply_putaway_rule",
|
||||
"items_tab",
|
||||
"bom_info_section",
|
||||
"from_bom",
|
||||
"use_multi_level_bom",
|
||||
@ -256,7 +255,7 @@
|
||||
"description": "As per Stock UOM",
|
||||
"fieldname": "fg_completed_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "For Quantity",
|
||||
"label": "Finished Good Quantity ",
|
||||
"oldfieldname": "fg_completed_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"print_hide": 1
|
||||
@ -612,11 +611,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "items_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Items"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "bom_info_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "BOM Info"
|
||||
@ -644,8 +639,10 @@
|
||||
"oldfieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "section_break_7qsm",
|
||||
"fieldtype": "Section Break"
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Process Loss"
|
||||
},
|
||||
{
|
||||
"depends_on": "process_loss_percentage",
|
||||
@ -677,7 +674,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-01-03 16:02:50.741816",
|
||||
"modified": "2023-04-06 12:42:56.673180",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Entry",
|
||||
|
@ -245,17 +245,17 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
item.expense_account = expense_account
|
||||
|
||||
def update_status(self, status=None, update_modified=False):
|
||||
if self.docstatus >= 1 and not status:
|
||||
if self.docstatus == 1:
|
||||
if not status:
|
||||
if self.docstatus == 0:
|
||||
status = "Draft"
|
||||
elif self.docstatus == 1:
|
||||
status = "Completed"
|
||||
if self.is_return:
|
||||
status = "Return"
|
||||
return_against = frappe.get_doc("Subcontracting Receipt", self.return_against)
|
||||
return_against.run_method("update_status")
|
||||
else:
|
||||
if self.per_returned == 100:
|
||||
status = "Return Issued"
|
||||
elif self.status == "Draft":
|
||||
status = "Completed"
|
||||
elif self.per_returned == 100:
|
||||
status = "Return Issued"
|
||||
elif self.docstatus == 2:
|
||||
status = "Cancelled"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user