From 1b6ca170c00e6044365d1f35e834d22d96f1a40b Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Thu, 19 Sep 2024 15:15:30 +0800 Subject: [PATCH 1/9] =?UTF-8?q?bom=E7=BB=84=E8=A3=85=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/wizard/jikimo_bom_wizard.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sf_tool_management/wizard/jikimo_bom_wizard.py b/sf_tool_management/wizard/jikimo_bom_wizard.py index ed6fe790..7a31711c 100644 --- a/sf_tool_management/wizard/jikimo_bom_wizard.py +++ b/sf_tool_management/wizard/jikimo_bom_wizard.py @@ -17,6 +17,22 @@ class JikimoBomWizard(models.TransientModel): ], string='组装方式', required=True) is_ok = fields.Boolean('确认上述信息正确无误。') + + @api.model + def default_get(self, fields): + res = super(JikimoBomWizard, self).default_get(fields) + # 根据某个字段的值设置默认选项 + if 'default_bom_id' in self.env.context: + jikimo_bom = self.env['jikimo.bom'].browse(self.env.context['default_bom_id']) + if not jikimo_bom: + return res + + if jikimo_bom.options: + res['assembly_options'] = jikimo_bom.options + # some_field_value = self.env.context.get('some_field') + # if some_field_value == 'condition_value': + # res['default_option'] = 'option2' # 设置为特定选项 + return res def submit(self): if not self.bom_id: raise UserError('缺少bom信息') From 51628c081a14f132480f58ae5f656ceb1486bff4 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Thu, 19 Sep 2024 17:27:02 +0800 Subject: [PATCH 2/9] =?UTF-8?q?1=E3=80=81=E7=A6=81=E7=94=A8=E8=B6=85?= =?UTF-8?q?=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98=E4=B9=8B=E5=A4=96=E7=9A=84?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E9=80=9A=E8=BF=87=E5=BA=93=E5=AD=98=E6=A6=82?= =?UTF-8?q?=E8=A7=88=E8=B7=B3=E8=BD=AC=E5=88=B0=E8=B0=83=E6=8B=A8=E5=8D=95?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84=E8=B0=83=E6=8B=A8=E5=8D=95=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=8C=89=E9=92=AE=EF=BC=8C=E9=9A=90=E8=97=8F=E5=88=B6?= =?UTF-8?q?=E9=80=A0=E4=BD=9C=E4=B8=9A=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=8D=95?= =?UTF-8?q?=E6=8D=AE=EF=BC=9B2=E3=80=81=E4=BC=98=E5=8C=96=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_warehouse/models/model.py | 13 ++++++------- sf_warehouse/views/view.xml | 1 + sf_warehouse/wizard/wizard.py | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index d3f9c585..97ef47e5 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -931,13 +931,6 @@ class SfStockMoveLine(models.Model): if not record.destination_location_id.product_id: record.destination_location_id.product_id = record.product_id.id - @api.model_create_multi - def create(self, vals_list): - - records = super(SfStockMoveLine, self).create(vals_list) - self.put_shelf_location(records) - return records - class SfStockPicking(models.Model): _inherit = 'stock.picking' @@ -1122,6 +1115,12 @@ class SfPickingType(models.Model): 'sf_warehouse.group_sf_stock_manager' ) + def _get_action(self, action_xmlid): + action = super(SfPickingType, self)._get_action(action_xmlid) + if not self.env.user.has_group('base.group_system'): + action['context']['create'] = False + return action + class CustomStockMove(models.Model): _name = 'stock.move' diff --git a/sf_warehouse/views/view.xml b/sf_warehouse/views/view.xml index fadaa58f..10be546c 100644 --- a/sf_warehouse/views/view.xml +++ b/sf_warehouse/views/view.xml @@ -4,6 +4,7 @@ {'search_default_groupby_code':1} + [('name', '!=', '制造')] diff --git a/sf_warehouse/wizard/wizard.py b/sf_warehouse/wizard/wizard.py index 62ed5771..a6fd68d4 100644 --- a/sf_warehouse/wizard/wizard.py +++ b/sf_warehouse/wizard/wizard.py @@ -77,18 +77,20 @@ class ShelfLocationWizard(models.TransientModel): def confirm_the_change(self): if self.destination_barcode_id: + stocks = [] if self.lot_id: self.current_barcode_id.product_sn_id = False self.destination_barcode_id.product_sn_id = self.lot_id.id - self.create_stock_moves(self.lot_id, 1) + stocks = self.create_stock_moves(self.lot_id, 1) elif self.current_product_sn_ids: for current_product_sn_id in self.current_product_sn_ids: - self.create_stock_moves(current_product_sn_id.lot_id, current_product_sn_id.qty_num) + stocks = self.create_stock_moves(current_product_sn_id.lot_id, current_product_sn_id.qty_num) current_product_sn_id.write({ 'qty_num': 0 }) else: raise ValidationError('没有需要变更的批次/序列号!') + self.env['stock.move.line'].sudo().put_shelf_location(stocks[-1]) else: raise ValidationError('请选择目标货位编码!') From 3cacca80e9fd72d7e89b627bdd52cc1c8ebdc18c Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Thu, 19 Sep 2024 17:35:57 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/views/jikimo_bom.xml | 4 ++-- sf_tool_management/views/tool_inventory.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sf_tool_management/views/jikimo_bom.xml b/sf_tool_management/views/jikimo_bom.xml index c42af591..50234ac2 100644 --- a/sf_tool_management/views/jikimo_bom.xml +++ b/sf_tool_management/views/jikimo_bom.xml @@ -9,7 +9,7 @@ jikimo.bom.form jikimo.bom -
+