fix: Mapping Customer Provided Material Request to Stock Entry
- Fixed inability to map Material Request to Stock Entry - Commonified Customer Provided Item validation
This commit is contained in:
parent
2c805ef951
commit
fd04e96bdd
@ -21,6 +21,7 @@ class StockController(AccountsController):
|
||||
super(StockController, self).validate()
|
||||
self.validate_inspection()
|
||||
self.validate_serialized_batch()
|
||||
self.validate_customer_provided_item()
|
||||
|
||||
def make_gl_entries(self, gl_entries=None, repost_future_gle=True, from_repost=False):
|
||||
if self.docstatus == 2:
|
||||
@ -377,6 +378,12 @@ class StockController(AccountsController):
|
||||
for blanket_order in blanket_orders:
|
||||
frappe.get_doc("Blanket Order", blanket_order).update_ordered_qty()
|
||||
|
||||
def validate_customer_provided_item(self):
|
||||
for d in self.get('items'):
|
||||
# Customer Provided parts will have zero valuation rate
|
||||
if frappe.db.get_value('Item', d.item_code, 'is_customer_provided_item'):
|
||||
d.allow_zero_valuation_rate = 1
|
||||
|
||||
def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None,
|
||||
warehouse_account=None, company=None):
|
||||
def _delete_gl_entries(voucher_type, voucher_no):
|
||||
|
@ -112,7 +112,6 @@ class DeliveryNote(SellingController):
|
||||
self.so_required()
|
||||
self.validate_proj_cust()
|
||||
self.check_sales_order_on_hold_or_close("against_sales_order")
|
||||
self.validate_for_items()
|
||||
self.validate_warehouse()
|
||||
self.validate_uom_is_integer("stock_uom", "stock_qty")
|
||||
self.validate_uom_is_integer("uom", "qty")
|
||||
@ -166,12 +165,6 @@ class DeliveryNote(SellingController):
|
||||
if not res:
|
||||
frappe.throw(_("Customer {0} does not belong to project {1}").format(self.customer, self.project))
|
||||
|
||||
def validate_for_items(self):
|
||||
for d in self.get('items'):
|
||||
#Customer Provided parts will have zero valuation rate
|
||||
if frappe.db.get_value('Item', d.item_code, 'is_customer_provided_item'):
|
||||
d.allow_zero_valuation_rate = 1
|
||||
|
||||
def validate_warehouse(self):
|
||||
super(DeliveryNote, self).validate_warehouse()
|
||||
|
||||
|
@ -454,6 +454,9 @@ def make_stock_entry(source_name, target_doc=None):
|
||||
else:
|
||||
target.s_warehouse = obj.warehouse
|
||||
|
||||
if source_parent.material_request_type == "Customer Provided":
|
||||
target.allow_zero_valuation_rate = 1
|
||||
|
||||
def set_missing_values(source, target):
|
||||
target.purpose = source.material_request_type
|
||||
if source.job_card:
|
||||
@ -471,7 +474,7 @@ def make_stock_entry(source_name, target_doc=None):
|
||||
"doctype": "Stock Entry",
|
||||
"validation": {
|
||||
"docstatus": ["=", 1],
|
||||
"material_request_type": ["in", ["Material Transfer", "Material Issue"]]
|
||||
"material_request_type": ["in", ["Material Transfer", "Material Issue", "Customer Provided"]]
|
||||
}
|
||||
},
|
||||
"Material Request Item": {
|
||||
|
@ -357,7 +357,7 @@ class PurchaseReceipt(BuyingController):
|
||||
if warehouse_with_no_account:
|
||||
frappe.msgprint(_("No accounting entries for the following warehouses") + ": \n" +
|
||||
"\n".join(warehouse_with_no_account))
|
||||
|
||||
|
||||
return process_gl_map(gl_entries)
|
||||
|
||||
def get_asset_gl_entry(self, gl_entries):
|
||||
@ -628,7 +628,7 @@ def get_item_account_wise_additional_cost(purchase_document):
|
||||
|
||||
if not landed_cost_vouchers:
|
||||
return
|
||||
|
||||
|
||||
item_account_wise_cost = {}
|
||||
|
||||
for lcv in landed_cost_vouchers:
|
||||
|
@ -50,6 +50,7 @@ class StockEntry(StockController):
|
||||
self.validate_posting_time()
|
||||
self.validate_purpose()
|
||||
self.validate_item()
|
||||
self.validate_customer_provided_item()
|
||||
self.validate_qty()
|
||||
self.set_transfer_qty()
|
||||
self.validate_uom_is_integer("uom", "qty")
|
||||
@ -203,10 +204,6 @@ class StockEntry(StockController):
|
||||
frappe.throw(_("Row #{0}: Please specify Serial No for Item {1}").format(item.idx, item.item_code),
|
||||
frappe.MandatoryError)
|
||||
|
||||
#Customer Provided parts will have zero valuation rate
|
||||
if frappe.db.get_value('Item', item.item_code, 'is_customer_provided_item'):
|
||||
item.allow_zero_valuation_rate = 1
|
||||
|
||||
def validate_qty(self):
|
||||
manufacture_purpose = ["Manufacture", "Material Consumption for Manufacture"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user