From f19af2a33f16808b6f3d3294f7ae21200408c0f4 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 12 Jan 2024 16:40:29 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=92=E7=A8=8B?= =?UTF-8?q?=E5=8A=A8=E4=BD=9C=E5=AF=B9=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 21 +++++++++++---------- sf_plan/models/custom_plan.py | 8 ++++++++ sf_sale/security/ir.model.access.csv | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 185817e9..cb326ee8 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -8,8 +8,6 @@ from odoo.exceptions import UserError from odoo.addons.sf_base.commons.common import Common from odoo.tools import float_compare, float_round, float_is_zero, format_datetime -from odoo.tools import float_compare, float_is_zero - class MrpProduction(models.Model): _inherit = 'mrp.production' @@ -162,7 +160,6 @@ class MrpProduction(models.Model): logging.info('fetchCNC error:%s' % e) raise UserError("cnc程序获取编程单失败,请联系管理员") - # 维修模块按钮 def button_maintenance_req(self): self.ensure_one() @@ -489,7 +486,7 @@ class MrpProduction(models.Model): self._reset_work_order_sequence() return True - #修改标记已完成方法 + # 修改标记已完成方法 def button_mark_done1(self): self._button_mark_done_sanity_checks() @@ -506,7 +503,6 @@ class MrpProduction(models.Model): productions_not_to_backorder = self productions_to_backorder = self.env['mrp.production'] - backorders = productions_to_backorder and productions_to_backorder._split_productions() backorders = backorders - productions_to_backorder @@ -514,13 +510,16 @@ class MrpProduction(models.Model): productions_to_backorder._post_inventory(cancel_backorder=True) # if completed products make other confirmed/partially_available moves available, assign them - done_move_finished_ids = (productions_to_backorder.move_finished_ids | productions_not_to_backorder.move_finished_ids).filtered(lambda m: m.state == 'done') + done_move_finished_ids = ( + productions_to_backorder.move_finished_ids | productions_not_to_backorder.move_finished_ids).filtered( + lambda m: m.state == 'done') done_move_finished_ids._trigger_assign() # Moves without quantity done are not posted => set them as done instead of canceling. In # case the user edits the MO later on and sets some consumed quantity on those, we do not # want the move lines to be canceled. - (productions_not_to_backorder.move_raw_ids | productions_not_to_backorder.move_finished_ids).filtered(lambda x: x.state not in ('done', 'cancel')).write({ + (productions_not_to_backorder.move_raw_ids | productions_not_to_backorder.move_finished_ids).filtered( + lambda x: x.state not in ('done', 'cancel')).write({ 'state': 'done', 'product_uom_qty': 0.0, }) @@ -546,8 +545,10 @@ class MrpProduction(models.Model): 'res_id': self.id, 'target': 'main', } - if self.user_has_groups('mrp.group_mrp_reception_report') and self.picking_type_id.auto_show_reception_report: - lines = self.move_finished_ids.filtered(lambda m: m.product_id.type == 'product' and m.state != 'cancel' and m.quantity_done and not m.move_dest_ids) + if self.user_has_groups( + 'mrp.group_mrp_reception_report') and self.picking_type_id.auto_show_reception_report: + lines = self.move_finished_ids.filtered(lambda + m: m.product_id.type == 'product' and m.state != 'cancel' and m.quantity_done and not m.move_dest_ids) if lines: if any(mo.show_allocation for mo in self): action = self.action_view_reception_report() @@ -574,4 +575,4 @@ class MrpProduction(models.Model): 'domain': [('id', 'in', backorders.ids)], 'view_mode': 'tree,form', }) - return action \ No newline at end of file + return action diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py index 96e98773..f3a91ed5 100644 --- a/sf_plan/models/custom_plan.py +++ b/sf_plan/models/custom_plan.py @@ -195,6 +195,10 @@ class sf_production_plan(models.Model): item.date_planned_start, item.date_planned_finished record.state = 'done' record.production_id.schedule_state = '已排' + # self.env['sale.order'].browse(record.production_id.origin).schedule_status = 'to process' + sale_obj = self.env['sale.order'].search([('name', '=', record.origin)]) + if 'S' in sale_obj.name: + sale_obj.schedule_status = 'to process' mrp_production_ids = record.production_id._get_children().ids print('mrp_production_ids', mrp_production_ids) for i in mrp_production_ids: @@ -276,6 +280,10 @@ class sf_production_plan(models.Model): self.production_line_id = False aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)]) aa.schedule_state = '未排' + # self.env['sale.order'].browse(record.production_id.origin).schedule_status = 'to shedule' + sale_obj = self.env['sale.order'].search([('name', '=', self.origin)]) + if 'S' in sale_obj.name: + sale_obj.schedule_status = 'to schedule' return self.date_planned_finished def liucheng_cs(self): diff --git a/sf_sale/security/ir.model.access.csv b/sf_sale/security/ir.model.access.csv index 3f9eee1f..e6b69761 100644 --- a/sf_sale/security/ir.model.access.csv +++ b/sf_sale/security/ir.model.access.csv @@ -72,7 +72,7 @@ access_purchase_order_wizard_group_purchase_director,purchase_order_wizard_group 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 +access_sale_order,sale.order,sale.model_sale_order,sf_base.group_plan_dispatch,1,1,0,0 access_res_partner_group_sale_salemanager,res_partner_group_sale_salemanager,base.model_res_partner,sf_base.group_sale_salemanager,1,0,1,0 access_res_partner_group_sale_director,res_partner_group_sale_director,base.model_res_partner,sf_base.group_sale_director,1,0,1,0 access_res_partner_group_purchase,res_partner_group_purchase,base.model_res_partner,sf_base.group_purchase,1,0,1,0 From 9bab450af10892b04a9900c082124b846f3c82ca Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Wed, 17 Jan 2024 09:56:40 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=AF=B9=E9=99=A4=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=A4=96=EF=BC=8C=E9=9A=90=E8=97=8F=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/change_stock_move_views.xml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sf_warehouse/views/change_stock_move_views.xml b/sf_warehouse/views/change_stock_move_views.xml index d0999a7b..b0bc37ae 100644 --- a/sf_warehouse/views/change_stock_move_views.xml +++ b/sf_warehouse/views/change_stock_move_views.xml @@ -37,5 +37,26 @@ + + + sf.view.picking.form + stock.picking + + + + + + +
+ + +