Accept Merge Request #1325: (feature/tax_sync -> develop)

Merge Request: 隐藏新增按钮

Created By: @廖丹龙
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @廖丹龙
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1325?initial=true
This commit is contained in:
廖丹龙
2024-09-19 17:38:32 +08:00
committed by Coding
3 changed files with 19 additions and 3 deletions

View File

@@ -9,7 +9,7 @@
<field name="name">jikimo.bom.form</field>
<field name="model">jikimo.bom</field>
<field name="arch" type="xml">
<form>
<form create="False">
<header>
<button type="action" name="%(action_jikimo_bom_wizard)d"
class="btn btn-info" string="组装方式.." context="{'default_bom_id':id}"
@@ -31,7 +31,7 @@
<notebook colspan="4">
<page string="物料清单">
<field name="product_ids" context="{'jikimo_bom_product': True}">
<tree>
<tree create="False">
<field name="name"/>
<!-- <field name="categ_id"/>-->
<field name="cutting_tool_material_id"/>

View File

@@ -20,7 +20,7 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='extension']" position="after">
<searchpanel>
<field name="knife_handle_model" enable_counters="1"/>
<field name="functional_cutting_tool_model_id" enable_counters="1"/>
<!-- <field name="job_id" enable_counters="1"/>-->
<!-- <field name="department_id" enable_counters="1"/>-->
<!-- <field name="company_id" enable_counters="1"/>-->

View File

@@ -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信息')