-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: track overrides for stock and manufacturing cycles (v15)
- Loading branch information
Rohan Bansal
committed
May 30, 2024
1 parent
ffb173d
commit 578a407
Showing
8 changed files
with
262 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Track Overrides | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- version-14 | ||
- version-15 | ||
|
||
jobs: | ||
track_overrides: | ||
runs-on: ubuntu-latest | ||
name: Track Overrides | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Track Overrides | ||
uses: diamorafaela/track-overrides@main | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 59 additions & 43 deletions
102
inventory_tools/inventory_tools/overrides/production_plan.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,59 @@ | ||
import json | ||
|
||
import frappe | ||
from erpnext.manufacturing.doctype.production_plan.production_plan import ProductionPlan | ||
from erpnext.manufacturing.doctype.work_order.work_order import get_default_warehouse | ||
|
||
|
||
class InventoryToolsProductionPlan(ProductionPlan): | ||
@frappe.whitelist() | ||
def make_work_order(self): | ||
wo_list, po_list = [], [] | ||
subcontracted_po = {} | ||
default_warehouses = get_default_warehouse() | ||
|
||
self.make_work_order_for_finished_goods(wo_list, default_warehouses) | ||
self.make_work_order_for_subassembly_items(wo_list, subcontracted_po, default_warehouses) | ||
if frappe.get_value("Inventory Tools Settings", self.company, "create_purchase_orders"): | ||
self.make_subcontracted_purchase_order(subcontracted_po, po_list) | ||
self.show_list_created_message("Work Order", wo_list) | ||
self.show_list_created_message("Purchase Order", po_list) | ||
|
||
def make_work_order_for_subassembly_items(self, wo_list, subcontracted_po, default_warehouses): | ||
for row in self.sub_assembly_items: | ||
if row.type_of_manufacturing == "Subcontract": | ||
subcontracted_po.setdefault(row.supplier, []).append(row) | ||
if not frappe.get_value( | ||
"Inventory Tools Settings", self.company, "enable_work_order_subcontracting" | ||
): | ||
continue | ||
|
||
if row.type_of_manufacturing == "Material Request": | ||
continue | ||
|
||
work_order_data = { | ||
"wip_warehouse": default_warehouses.get("wip_warehouse"), | ||
"fg_warehouse": default_warehouses.get("fg_warehouse"), | ||
"company": self.get("company"), | ||
} | ||
|
||
self.prepare_data_for_sub_assembly_items(row, work_order_data) | ||
work_order = self.create_work_order(work_order_data) | ||
if work_order: | ||
wo_list.append(work_order) | ||
import frappe | ||
from erpnext.manufacturing.doctype.production_plan.production_plan import ProductionPlan | ||
from erpnext.manufacturing.doctype.work_order.work_order import get_default_warehouse | ||
from frappe import _ | ||
|
||
|
||
class InventoryToolsProductionPlan(ProductionPlan): | ||
@frappe.whitelist() | ||
def make_work_order(self): | ||
""" | ||
HASH: 544e56a71cac8751f5ff9fb7c32fe3a0e9f3eb85 | ||
REPO: https://github.com/frappe/erpnext/ | ||
PATH: erpnext/manufacturing/doctype/production_plan/production_plan.py | ||
METHOD: make_work_order | ||
""" | ||
|
||
wo_list, po_list = [], [] | ||
subcontracted_po = {} | ||
default_warehouses = get_default_warehouse() | ||
|
||
self.make_work_order_for_finished_goods(wo_list, default_warehouses) | ||
self.make_work_order_for_subassembly_items(wo_list, subcontracted_po, default_warehouses) | ||
if frappe.get_value("Inventory Tools Settings", self.company, "create_purchase_orders"): | ||
self.make_subcontracted_purchase_order(subcontracted_po, po_list) | ||
self.show_list_created_message("Work Order", wo_list) | ||
self.show_list_created_message("Purchase Order", po_list) | ||
|
||
if not wo_list: | ||
frappe.msgprint(_("No Work Orders were created")) | ||
|
||
def make_work_order_for_subassembly_items(self, wo_list, subcontracted_po, default_warehouses): | ||
""" | ||
HASH: 544e56a71cac8751f5ff9fb7c32fe3a0e9f3eb85 | ||
REPO: https://github.com/frappe/erpnext/ | ||
PATH: erpnext/manufacturing/doctype/production_plan/production_plan.py | ||
METHOD: make_work_order_for_subassembly_items | ||
""" | ||
|
||
for row in self.sub_assembly_items: | ||
if row.type_of_manufacturing == "Subcontract": | ||
subcontracted_po.setdefault(row.supplier, []).append(row) | ||
if not frappe.get_value( | ||
"Inventory Tools Settings", self.company, "enable_work_order_subcontracting" | ||
): | ||
continue | ||
|
||
if row.type_of_manufacturing == "Material Request": | ||
continue | ||
|
||
work_order_data = { | ||
"wip_warehouse": default_warehouses.get("wip_warehouse"), | ||
"fg_warehouse": default_warehouses.get("fg_warehouse"), | ||
"company": self.get("company"), | ||
} | ||
|
||
self.prepare_data_for_sub_assembly_items(row, work_order_data) | ||
work_order = self.create_work_order(work_order_data) | ||
if work_order: | ||
wo_list.append(work_order) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.