Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Fetch values from manufacturing Request to Raw Material Request #389

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ frappe.ui.form.on("Jewellery Order Item", {
is_available: function(frm, cdt, cdn) {
let all_finished = true;
let total_weightage = 0;
let total_qty = 0;
let childtable = frm.doc.jewellery_order_items || [];
for (let i = 0; i < childtable.length; i++) {
if (childtable[i].is_available) {
Expand All @@ -87,12 +86,6 @@ frappe.ui.form.on("Jewellery Order Item", {
all_finished = false;
}
}
if (frm.doc.jewellery_order_items) {
total_qty = frm.doc.jewellery_order_items.filter(function(row) {
return row.is_available == 1;
}).length;
}
frm.set_value('available_item_quantity', total_qty);
frm.set_value('finished', all_finished ? 1 : 0);
frm.set_value('weight_of_available_item', total_weightage);
update_available_item_quantity(frm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"field_order": [
"title",
"request_from",
"raw_material_request",
"jewellery_order_item",
"column_break_i3eg",
"jewellery_order",
"manufacturing_request",
"raw_material_request",
"required_date",
"section_break_hpbr",
"type",
"category",
"quantity",
"posting_date",
"posting_time",
"column_break_ky2t",
Expand All @@ -28,7 +28,7 @@
"weight",
"keep_metal_ledger",
"column_break_izcc",
"quantity",
"category",
"supervisor_warehouse",
"finished",
"section_break_1jdd",
Expand Down Expand Up @@ -130,6 +130,7 @@
"label": "Design Description"
},
{
"depends_on": "eval:doc.request_from == \"Jewellery Order\"",
"fieldname": "category",
"fieldtype": "Link",
"label": "Category",
Expand Down Expand Up @@ -251,7 +252,7 @@
"link_fieldname": "manufacturing_request"
}
],
"modified": "2024-05-03 14:12:21.910906",
"modified": "2024-05-07 12:51:18.505865",
"modified_by": "Administrator",
"module": "AuMMS Manufacturing",
"name": "Manufacturing Request",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
class ManufacturingRequest(Document):

def autoname(self):
self.title = f"{self.purity} {self.expected_weight} {self.uom} {self.type} {self.category}"
if self.request_from == "Jewellery Order":
self.title = f"{self.purity} {self.expected_weight} {self.uom} {self.type} {self.category}"
elif self.request_from == "Raw Material Request" :
self.title = f"{self.purity} {self.expected_weight} {self.uom} {self.type}"

def before_insert(self):
self.update_manufacturing_stages()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@
"raw_material_available",
"raw_materials_section",
"items",
"amended_from"
"amended_from",
"section_break_ulxh",
"required_date",
"purity",
"quantity",
"supervisor_warehouse",
"column_break_bjkf",
"type",
"uom",
"category"
],
"fields": [
{
Expand Down Expand Up @@ -69,12 +78,74 @@
"fieldtype": "Check",
"label": "Raw Material Available",
"read_only": 1
},
{
"fetch_from": "manufacturing_request.required_date",
"fieldname": "required_date",
"fieldtype": "Date",
"hidden": 1,
"label": "Required Date"
},
{
"fieldname": "section_break_ulxh",
"fieldtype": "Section Break",
"hidden": 1
},
{
"fetch_from": "manufacturing_request.type",
"fieldname": "type",
"fieldtype": "Link",
"hidden": 1,
"label": "Type",
"options": "Item Type"
},
{
"fetch_from": "manufacturing_request.uom",
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 1,
"label": "UOM",
"options": "UOM"
},
{
"fetch_from": "manufacturing_request.quantity",
"fieldname": "quantity",
"fieldtype": "Int",
"hidden": 1,
"label": "Quantity"
},
{
"fieldname": "column_break_bjkf",
"fieldtype": "Column Break"
},
{
"fetch_from": "manufacturing_request.category",
"fieldname": "category",
"fieldtype": "Link",
"hidden": 1,
"label": "Category",
"options": "Item Category"
},
{
"fetch_from": "manufacturing_request.purity",
"fieldname": "purity",
"fieldtype": "Link",
"hidden": 1,
"label": "Purity",
"options": "Purity"
},
{
"fetch_from": "manufacturing_request.supervisor_warehouse",
"fieldname": "supervisor_warehouse",
"fieldtype": "Link",
"label": "Supervisor Warehouse",
"options": "Warehouse"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2024-05-06 12:13:01.179566",
"modified": "2024-05-07 13:05:32.182882",
"modified_by": "Administrator",
"module": "AuMMS Manufacturing",
"name": "Raw Material Bundle",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ def create_raw_material_request(docname):
new_raw_material_request.raw_material_bundle = raw_material_bundle.name
new_raw_material_request.manufacturing_request = raw_material_bundle.manufacturing_request
new_raw_material_request.required_quantity = raw_material.required_quantity - raw_material.available_quantity
new_raw_material_request.required_date = raw_material_bundle.required_date
new_raw_material_request.uom = raw_material_bundle.uom
new_raw_material_request.item_type = raw_material_bundle.type
new_raw_material_request.purity = raw_material_bundle.purity
new_raw_material_request.supervisor_warehouse = raw_material_bundle.supervisor_warehouse
new_raw_material_request.bundle_id = raw_material.raw_material_id
new_raw_material_request.append('raw_material_details', {
'item': raw_material.item,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"bundle_id",
"uom",
"required_quantity",
"supervisor_warehouse",
"section_break_9utr",
"required_date",
"item_type",
"purity",
"column_break_dw7z",
"not_available",
"priority",
Expand Down Expand Up @@ -123,12 +128,39 @@
{
"fieldname": "column_break_dw7z",
"fieldtype": "Column Break"
},
{
"fieldname": "required_date",
"fieldtype": "Date",
"label": "Required Date"
},
{
"fieldname": "section_break_9utr",
"fieldtype": "Column Break"
},
{
"fieldname": "item_type",
"fieldtype": "Link",
"label": "Item Type",
"options": "Item Type"
},
{
"fieldname": "purity",
"fieldtype": "Link",
"label": "Purity",
"options": "Purity"
},
{
"fieldname": "supervisor_warehouse",
"fieldtype": "Link",
"label": "Supervisor Warehouse",
"options": "Warehouse"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2024-05-06 14:32:14.681672",
"modified": "2024-05-07 13:06:36.599486",
"modified_by": "Administrator",
"module": "AuMMS Manufacturing",
"name": "Raw Material Request",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ class RawMaterialRequest(Document):
@frappe.whitelist()
def create_manufacturing_request(self):
manufacturing_request_exists = frappe.db.exists('Manufacturing Request', {'raw_material_request': self.name})
if not manufacturing_request_exists:
manufacturing_request = frappe.new_doc('Manufacturing Request')
manufacturing_request.request_from = 'Raw Material Request'
manufacturing_request.raw_material_request = self.name
manufacturing_request.jewellery_order = self.jewellery_order
# manufacturing_request.required_date = self.required_date
manufacturing_request.quantity = self.required_quantity
# manufacturing_request.total_weight = self.weight
# manufacturing_request.item_name = self.item_name
manufacturing_request.uom = self.uom
# manufacturing_request.type = self.item_type
manufacturing_request.insert(ignore_permissions=True)
frappe.msgprint(f"Manufacturing Request {manufacturing_request.name} created.", indicator="green", alert=1)
else:
frappe.throw(_('Manufacturing Request already exist for this {0}'.format(self.name)))
for item in self.raw_material_details:
if not manufacturing_request_exists:
manufacturing_request = frappe.new_doc('Manufacturing Request')
manufacturing_request.request_from = 'Raw Material Request'
manufacturing_request.raw_material_request = self.name
manufacturing_request.jewellery_order = self.jewellery_order
manufacturing_request.required_date = self.required_date
manufacturing_request.quantity = self.required_quantity
manufacturing_request.expected_weight = item.required_quantity
manufacturing_request.purity = self.purity
manufacturing_request.uom = self.uom
manufacturing_request.type = self.item_type
manufacturing_request.insert(ignore_permissions=True)
frappe.msgprint(f"Manufacturing Request {manufacturing_request.name} created.", indicator="green", alert=1)
else:
frappe.throw(_('Manufacturing Request already exist for this {0}'.format(self.name)))

@frappe.whitelist()
def create_purchase_order(self):
Expand Down
Loading