From 8e61d5f87c4ce692200ba95ffd2577e092836685 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Thu, 28 Dec 2023 10:50:44 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_base/security/group_security.xml | 2 +-
sf_warehouse/security/ir.model.access.csv | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/sf_base/security/group_security.xml b/sf_base/security/group_security.xml
index dd78c2c0..478d41b9 100644
--- a/sf_base/security/group_security.xml
+++ b/sf_base/security/group_security.xml
@@ -71,7 +71,7 @@
计划总监
-
+
diff --git a/sf_warehouse/security/ir.model.access.csv b/sf_warehouse/security/ir.model.access.csv
index 2367fbd7..87ddef13 100644
--- a/sf_warehouse/security/ir.model.access.csv
+++ b/sf_warehouse/security/ir.model.access.csv
@@ -96,7 +96,7 @@ access_stock_replenish_option,stock.replenishment.option,stock.model_stock_reple
access_mrp_production,mrp.production,mrp.model_mrp_production,sf_warehouse.group_sf_stock_user,1,1,1,0
access_sf_shelf_location,sf.shelf.location,model_sf_shelf_location,sf_base.group_plan_dispatch,1,0,0,0
-access_stock_move,stock.move,stock.model_stock_move,sf_base.group_plan_dispatch,1,0,0,0
+access_stock_move,stock.move,stock.model_stock_move,sf_base.group_plan_dispatch,1,1,1,0
access_stock_scrap_user,stock.scrap.user,stock.model_stock_scrap,sf_base.group_plan_dispatch,1,0,0,0
access_stock_scrap_manager,stock.scrap.manager,stock.model_stock_scrap,sf_base.group_plan_dispatch,1,0,0,0
access_stock_picking,stock.picking,stock.model_stock_picking,sf_base.group_plan_dispatch,1,0,0,0
@@ -104,8 +104,10 @@ access_stock_lot,stock.lot,stock.model_stock_lot,sf_base.group_plan_dispatch,1,1
access_stock_warehouse_orderpoint,stock.warehouse.orderpoint,stock.model_stock_warehouse_orderpoint,sf_base.group_plan_dispatch,1,0,0,0
access_stock_quant,stock.quant,stock.model_stock_quant,sf_base.group_plan_dispatch,1,0,0,0
-access_product_product,product.product,product.model_product_product,sf_base.group_plan_dispatch,1,1,1,0
-access_product_template,product.template,product.model_product_template,sf_base.group_plan_dispatch,1,1,1,0
+access_product_product,product.product,product.model_product_product,sf_base.group_plan_dispatch,1,0,0,0
+access_product_template,product.template,product.model_product_template,sf_base.group_plan_dispatch,1,0,0,0
+access_product_product,product.product,product.model_product_product,sf_base.group_plan_director,1,1,1,0
+access_product_template,product.template,product.model_product_template,sf_base.group_plan_director,1,1,1,0
access_stock_inventory_conflict,stock.inventory.conflict,stock.model_stock_inventory_conflict,sf_base.group_plan_dispatch,1,0,0,0
access_stock_inventory_warning,stock.inventory.warning,stock.model_stock_inventory_warning,sf_base.group_plan_dispatch,1,0,0,0
From 8ec038847ace47c0cbda88b31e1a50e1780cf3fa Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Fri, 29 Dec 2023 15:28:15 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_quality/security/ir.model.access.csv | 3 +--
sf_sale/security/ir.model.access.csv | 2 ++
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/sf_quality/security/ir.model.access.csv b/sf_quality/security/ir.model.access.csv
index a26c135b..45811bc7 100644
--- a/sf_quality/security/ir.model.access.csv
+++ b/sf_quality/security/ir.model.access.csv
@@ -62,7 +62,6 @@ access_quality_tag_group_quality_director,quality_tag_group_quality_director,qua
access_quality_reason_type_group_quality,quality_reason_group_quality,quality.model_quality_reason,sf_base.group_quality,1,0,0,0
access_quality_reason_type_group_quality_director,quality_reason_group_quality_director,quality.model_quality_reason,sf_base.group_quality_director,1,0,0,0
-
-
+access_quality_alert_stage,quality.alert.stage,quality.model_quality_alert_stage,sf_base.group_plan_dispatch,1,0,0,0
diff --git a/sf_sale/security/ir.model.access.csv b/sf_sale/security/ir.model.access.csv
index 9489a6cc..3e3a8df0 100644
--- a/sf_sale/security/ir.model.access.csv
+++ b/sf_sale/security/ir.model.access.csv
@@ -67,3 +67,5 @@ access_purchase_order_wizard_group_purchase,purchase_order_wizard_group_purchase
access_purchase_order_wizard_group_purchase_director,purchase_order_wizard_group_purchase_director,model_purchase_order_wizard,sf_base.group_purchase_director,1,1,1,0
access_crm_tag_group_sale_salemanager,crm_tag_group_sale_salemanager,sales_team.model_crm_tag,sf_base.group_sale_salemanager,1,0,0,0
access_crm_tag_group_sale_director,crm_tag_group_sale_director,sales_team.model_crm_tag,sf_base.group_sale_director,1,1,1,0
+
+access_sale_order,sale.order,sale.model_sale_order,sf_base.group_plan_dispatch,1,0,0,0
\ No newline at end of file
From 56d8190fc6ae9197038f8402987768e37af957ef Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Tue, 2 Jan 2024 11:47:40 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=9A=E5=8A=A1?=
=?UTF-8?q?=E9=80=BB=E8=BE=91:=E5=BD=93=E4=B8=BB=E5=88=B6=E9=80=A0?=
=?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=8E=92=E7=A8=8B=E5=90=8E=EF=BC=8C=E5=AD=90?=
=?UTF-8?q?bom=E8=87=AA=E5=8A=A8=E6=94=B9=E7=8A=B6=E6=80=81=E4=B8=BA?=
=?UTF-8?q?=E5=B7=B2=E6=8E=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_plan/models/custom_plan.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index 075c7e21..ddc7ed1c 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -173,6 +173,10 @@ class sf_production_plan(models.Model):
item.date_planned_start, item.date_planned_finished
self.state = 'done'
self.production_id.schedule_state = '已排'
+ mrp_production_ids = self.production_id._get_children().ids
+ print('mrp_production_ids', mrp_production_ids)
+ for i in mrp_production_ids:
+ self.env['mrp.production'].browse(i).schedule_state = '已排'
# self.production_id.date_planned_start = self.date_planned_start
# self.production_id.date_planned_finished = self.date_planned_finished
else:
From ccdbfda0192a81dfb1c89140f3df46cceab49a1a Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Tue, 2 Jan 2024 17:55:02 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=A3=80=E6=B5=8B=E4=BA=BA=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_machine_connect/views/machine_monitor.xml | 156 +++++++++----------
sf_manufacturing/models/mrp_workorder.py | 5 +-
sf_manufacturing/models/stock.py | 3 +-
3 files changed, 83 insertions(+), 81 deletions(-)
diff --git a/sf_machine_connect/views/machine_monitor.xml b/sf_machine_connect/views/machine_monitor.xml
index 83b89598..9c9a21a3 100644
--- a/sf_machine_connect/views/machine_monitor.xml
+++ b/sf_machine_connect/views/machine_monitor.xml
@@ -29,44 +29,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -216,46 +216,46 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 1edbb62f..48edcf7f 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -137,7 +137,10 @@ class ResMrpWorkOrder(models.Model):
"""
检测is_ok(是否合格)被修改的话,就将当前用户赋值给inspection_user_id
"""
- self.inspection_user_id = self.env.user.id
+ if not self.inspection_user_id:
+ self.inspection_user_id = self.env.user.id
+ else:
+ self.inspection_user_id = False
@api.onchange('functional_fixture_id')
def _onchange_functional_fixture_id(self):
diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index 4f2c43f3..27edc40f 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -202,8 +202,7 @@ class StockRule(models.Model):
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
if sale_order:
sale_order.write({'schedule_status': 'to schedule'})
- self.env['sf.production.plan'].sudo().with_company(company_id). \
- create({
+ self.env['sf.production.plan'].sudo().with_company(company_id).create({
'name': production.name,
'order_deadline': sale_order.deadline_of_delivery,
'production_id': production.id,
From b9bb528db02aa2ea4a4bdea9b3dab98bd4ec67da Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Wed, 3 Jan 2024 23:03:08 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E5=85=AC=E5=8F=B8=E7=B1=BB=E5=9E=8B=E5=8D=A1=E7=89=87=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E7=A8=8EID=EF=BC=8C=E8=AE=A1=E5=88=92=E5=A4=84tree?=
=?UTF-8?q?=E8=A7=86=E5=9B=BE=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=87=8F=E6=8E=92?=
=?UTF-8?q?=E7=A8=8Bbutton?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_base/__manifest__.py | 1 +
sf_base/views/change_base_view.xml | 15 +++++++++++++++
sf_plan/views/view.xml | 3 +++
3 files changed, 19 insertions(+)
create mode 100644 sf_base/views/change_base_view.xml
diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py
index e2fb731c..59ad967a 100644
--- a/sf_base/__manifest__.py
+++ b/sf_base/__manifest__.py
@@ -23,6 +23,7 @@
'views/tool_basic_param.xml',
'views/tool_menu.xml',
'views/menu_fixture_view.xml',
+ 'views/change_base_view.xml',
],
'demo': [
diff --git a/sf_base/views/change_base_view.xml b/sf_base/views/change_base_view.xml
new file mode 100644
index 00000000..3c02351a
--- /dev/null
+++ b/sf_base/views/change_base_view.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ sf.base.res.partner.kanban
+ res.partner
+
+
+
+
+
+
+
+
+
diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml
index fbca7218..4e872b5a 100644
--- a/sf_plan/views/view.xml
+++ b/sf_plan/views/view.xml
@@ -6,6 +6,9 @@
sf.production.plan
+
From ce58e989dda44df9a74cc198bc99c539e71988f9 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Thu, 4 Jan 2024 08:51:25 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E7=9A=84=E6=89=B9?=
=?UTF-8?q?=E9=87=8F=E6=8E=92=E7=A8=8B=E5=B7=B2=E5=AE=9E=E7=8E=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_plan/models/custom_plan.py | 75 ++++++++++++++++++-----------------
sf_plan/views/view.xml | 2 +-
2 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index ddc7ed1c..a60af7f3 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -153,44 +153,45 @@ class sf_production_plan(models.Model):
"""
排程方法
"""
- if not self.production_line_id:
- raise ValidationError("未选择生产线")
- else:
- workorder_id_list = self.production_id.workorder_ids.ids
- if self.production_id.workorder_ids:
- for item in self.production_id.workorder_ids:
- if item.name == 'CNC加工':
- item.date_planned_finished = datetime.now() + timedelta(days=100)
- item.date_planned_start = self.date_planned_start
- item.date_planned_finished = item.date_planned_start + timedelta(
- minutes=self.env['mrp.routing.workcenter'].sudo().search(
- [('name', '=', 'CNC加工')]).time_cycle)
- item.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
- [('name', '=', 'CNC加工')]).time_cycle
- self.calculate_plan_time_before(item, workorder_id_list)
- self.calculate_plan_time_after(item, workorder_id_list)
- self.date_planned_start, self.date_planned_finished = \
- item.date_planned_start, item.date_planned_finished
- self.state = 'done'
- self.production_id.schedule_state = '已排'
- mrp_production_ids = self.production_id._get_children().ids
- print('mrp_production_ids', mrp_production_ids)
- for i in mrp_production_ids:
- self.env['mrp.production'].browse(i).schedule_state = '已排'
- # self.production_id.date_planned_start = self.date_planned_start
- # self.production_id.date_planned_finished = self.date_planned_finished
+ for record in self:
+ if not record.production_line_id:
+ raise ValidationError("未选择生产线")
else:
- raise ValidationError("未找到工单")
- # self.date_planned_finished = self.date_planned_start + timedelta(days=3)
- # self.state = 'done'
- return {
- 'name': '排程甘特图',
- 'type': 'ir.actions.act_window',
- 'res_model': 'sf.production.plan', # 要跳转的模型名称
- # 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
- 'view_mode': 'gantt,tree,form',
- 'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
- }
+ workorder_id_list = record.production_id.workorder_ids.ids
+ if record.production_id.workorder_ids:
+ for item in record.production_id.workorder_ids:
+ if item.name == 'CNC加工':
+ item.date_planned_finished = datetime.now() + timedelta(days=100)
+ item.date_planned_start = record.date_planned_start
+ item.date_planned_finished = item.date_planned_start + timedelta(
+ minutes=record.env['mrp.routing.workcenter'].sudo().search(
+ [('name', '=', 'CNC加工')]).time_cycle)
+ item.duration_expected = record.env['mrp.routing.workcenter'].sudo().search(
+ [('name', '=', 'CNC加工')]).time_cycle
+ record.calculate_plan_time_before(item, workorder_id_list)
+ record.calculate_plan_time_after(item, workorder_id_list)
+ record.date_planned_start, record.date_planned_finished = \
+ item.date_planned_start, item.date_planned_finished
+ record.state = 'done'
+ record.production_id.schedule_state = '已排'
+ mrp_production_ids = record.production_id._get_children().ids
+ print('mrp_production_ids', mrp_production_ids)
+ for i in mrp_production_ids:
+ record.env['mrp.production'].browse(i).schedule_state = '已排'
+ # record.production_id.date_planned_start = record.date_planned_start
+ # record.production_id.date_planned_finished = record.date_planned_finished
+ else:
+ raise ValidationError("未找到工单")
+ # record.date_planned_finished = record.date_planned_start + timedelta(days=3)
+ # record.state = 'done'
+ return {
+ 'name': '排程甘特图',
+ 'type': 'ir.actions.act_window',
+ 'res_model': 'sf.production.plan', # 要跳转的模型名称
+ # 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
+ 'view_mode': 'gantt,tree,form',
+ 'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
+ }
def calculate_plan_time_before(self, item, workorder_id_list):
"""
diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml
index 4e872b5a..c1bdf5fe 100644
--- a/sf_plan/views/view.xml
+++ b/sf_plan/views/view.xml
@@ -5,7 +5,7 @@
sf.production.plan.tree
sf.production.plan
-
+