调整模型显示

This commit is contained in:
胡尧
2025-03-12 17:05:29 +08:00
parent b8bec37e15
commit 29337bfceb
14 changed files with 28 additions and 5 deletions

View File

@@ -32,6 +32,7 @@ class FixtureModel(models.Model):
multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型") multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型")
brand_id = fields.Many2one('sf.machine.brand', string="品牌") brand_id = fields.Many2one('sf.machine.brand', string="品牌")
model_file = fields.Binary(string="图片") model_file = fields.Binary(string="图片")
glb_url = fields.Char(string="图片")
status = fields.Boolean('状态') status = fields.Boolean('状态')
active = fields.Boolean('有效', default=False) active = fields.Boolean('有效', default=False)

View File

@@ -158,6 +158,8 @@
<!-- <field name="upload_model_file" widget="many2many_binary"/>--> <!-- <field name="upload_model_file" widget="many2many_binary"/>-->
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1" <field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': [('model_file', '=', False)]}"/> attrs="{'invisible': [('model_file', '=', False)]}"/>
<field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': [('glb_url', '=', False)]}"/>
</group> </group>
</group> </group>
<notebook> <notebook>

View File

@@ -44,7 +44,7 @@ class ResProductTemplate(models.Model):
else: else:
return self.env.ref('sf_dlm.product_uom_cubic_millimeter') return self.env.ref('sf_dlm.product_uom_cubic_millimeter')
# model_file = fields.Binary('模型文件') model_file = fields.Binary('模型文件')
# 胚料的库存路线设置 # 胚料的库存路线设置
# def _get_routes(self, route_type): # def _get_routes(self, route_type):

View File

@@ -22,12 +22,15 @@
<field name='manual_quotation' attrs="{'invisible':[('glb_url', '=', False)]}"/> <field name='manual_quotation' attrs="{'invisible':[('glb_url', '=', False)]}"/>
<field name="is_customer_provided" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])], 'readonly': True}" /> <field name="is_customer_provided" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])], 'readonly': True}" />
<field name="model_name" invisible="1"/> <field name="model_name" invisible="1"/>
<field name="upload_model_file" widget="many2many_binary" attrs="{'invisible': [('upload_model_file', '=', False)]}"/>
<field name="model_url" <field name="model_url"
widget="binary_download" widget="binary_download"
filename_field="model_name" filename_field="model_name"
attrs="{'invisible': ['|', '|',('categ_type', '!=', '成品'),('categ_type', '=', False),('model_url', '=', False)]}"/> attrs="{'invisible': ['|', '|',('categ_type', '!=', '成品'),('categ_type', '=', False),('model_url', '=', False)]}"/>
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1" <field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': ['|','|', ('categ_type', '!=', '成品'),('categ_type', '=', False),('model_file', '=', False)]}"/> attrs="{'invisible': ['|','|', ('categ_type', '!=', '成品'),('categ_type', '=', False),('model_file', '=', False)]}"/>
<field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': ['|','|', ('categ_type', '!=', '成品'),('categ_type', '=', False),('glb_url', '=', False)]}"/>
<field name='cutting_tool_type' invisible="1"/> <field name='cutting_tool_type' invisible="1"/>
<field name="fixture_material_type" invisible="1"/> <field name="fixture_material_type" invisible="1"/>
<field name="embryo_model_type_id" string="模型类型" options="{'no_create': True}" <field name="embryo_model_type_id" string="模型类型" options="{'no_create': True}"

View File

@@ -25,6 +25,7 @@ class MrpProduction(models.Model):
maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests") maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests")
request_ids = fields.One2many('maintenance.request', 'production_id') request_ids = fields.One2many('maintenance.request', 'production_id')
model_file = fields.Binary('模型文件', related='product_id.model_file') model_file = fields.Binary('模型文件', related='product_id.model_file')
glb_url = fields.Char('模型文件', related='product_id.glb_url')
schedule_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')], schedule_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')],
string='排程状态', default='未排') string='排程状态', default='未排')
work_order_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')], work_order_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')],
@@ -239,6 +240,7 @@ class MrpProduction(models.Model):
string='编程状态', string='编程状态',
tracking=True) tracking=True)
glb_file = fields.Binary("glb模型文件") glb_file = fields.Binary("glb模型文件")
glb_url = fields.Char("glb模型文件")
production_line_id = fields.Many2one('sf.production.line', string='生产线', tracking=True) production_line_id = fields.Many2one('sf.production.line', string='生产线', tracking=True)
plan_start_processing_time = fields.Datetime('计划开始加工时间') plan_start_processing_time = fields.Datetime('计划开始加工时间')
is_rework = fields.Boolean(string='是否返工', default=False) is_rework = fields.Boolean(string='是否返工', default=False)

View File

@@ -289,6 +289,7 @@ class ResMrpWorkOrder(models.Model):
cmm_ids = fields.One2many("sf.cmm.program", 'workorder_id', string="CMM程序") cmm_ids = fields.One2many("sf.cmm.program", 'workorder_id', string="CMM程序")
tray_code = fields.Char(string="托盘编码") tray_code = fields.Char(string="托盘编码")
glb_file = fields.Binary("glb模型文件", related='production_id.model_file') glb_file = fields.Binary("glb模型文件", related='production_id.model_file')
glb_url = fields.Char("glb模型文件", related='production_id.glb_url')
is_subcontract = fields.Boolean(string='是否外协') is_subcontract = fields.Boolean(string='是否外协')
surface_technics_parameters_id = fields.Many2one('sf.production.process.parameter', string="表面工艺可选参数") surface_technics_parameters_id = fields.Many2one('sf.production.process.parameter', string="表面工艺可选参数")

View File

@@ -1106,6 +1106,7 @@ class ResProductFixture(models.Model):
fixture_material_type = fields.Char(string="夹具物料类型", related='fixture_material_id.name') fixture_material_type = fields.Char(string="夹具物料类型", related='fixture_material_id.name')
multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型") multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型")
model_file = fields.Binary(string="3D模型图") model_file = fields.Binary(string="3D模型图")
glb_url = fields.Char(string="3D模型图")
# 夹具物料基本参数 # 夹具物料基本参数
diameter = fields.Float('直径(mm)', digits=(16, 2)) diameter = fields.Float('直径(mm)', digits=(16, 2))

View File

@@ -450,7 +450,9 @@
</button> </button>
</div> </div>
<field name="product_id" position="after"> <field name="product_id" position="after">
<field name="model_file" string="产品模型" readonly="1" widget="Viewer3D"/> <field name="model_file" string="产品模型" readonly="1" widget="Viewer3D" attrs="{'invisible': [('model_file', '=', False)]}"/>
<field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': [('glb_url', '=', False)]}"/>
</field> </field>
</field> </field>
</record> </record>

View File

@@ -26,6 +26,7 @@ class QualityCheck(models.Model):
string='生产线') string='生产线')
equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备') equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备')
model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型') model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型')
glb_url = fields.Char(related='workorder_id.glb_url', string='加工模型')
detection_report = fields.Binary(related='workorder_id.detection_report', readonly=True, string='检测报告') detection_report = fields.Binary(related='workorder_id.detection_report', readonly=True, string='检测报告')
test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], string="检测结果", test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], string="检测结果",

View File

@@ -12,6 +12,7 @@ class SfQualityCncTest(models.Model):
production_id = fields.Many2one(related='workorder_id.production_id', string='制造订单') production_id = fields.Many2one(related='workorder_id.production_id', string='制造订单')
product_id = fields.Many2one(related='workorder_id.product_id', string='产品') product_id = fields.Many2one(related='workorder_id.product_id', string='产品')
model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型') model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型')
glb_url = fields.Char(related='workorder_id.glb_url', string='加工模型')
processing_panel = fields.Char(related='workorder_id.processing_panel', string='加工面') processing_panel = fields.Char(related='workorder_id.processing_panel', string='加工面')
equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备') equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备')
production_line_id = fields.Many2one(related='workorder_id.production_line_id', production_line_id = fields.Many2one(related='workorder_id.production_line_id',

View File

@@ -13,6 +13,8 @@
<field name="equipment_id" attrs="{'invisible': [('production_id', '=', False)]}"/> <field name="equipment_id" attrs="{'invisible': [('production_id', '=', False)]}"/>
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1" <field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': ['|',('model_file', '=', False), ('production_id', '=', False)]}"/> attrs="{'invisible': ['|',('model_file', '=', False), ('production_id', '=', False)]}"/>
<field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': ['|',('glb_url', '=', False), ('production_id', '=', False)]}"/>
</xpath> </xpath>
<xpath expr="//field[@name='partner_id']" position="after"> <xpath expr="//field[@name='partner_id']" position="after">
<field name="processing_panel" attrs="{'invisible': [('production_id', '=', False)]}"/> <field name="processing_panel" attrs="{'invisible': [('production_id', '=', False)]}"/>

View File

@@ -87,7 +87,8 @@
<field name="product_id"/> <field name="product_id"/>
<field name="production_line_id"/> <field name="production_line_id"/>
<field name="equipment_id"/> <field name="equipment_id"/>
<field name="model_file" widget="Viewer3D"/> <field name="model_file" widget="Viewer3D" attrs="{'invisible': [('model_file', '=', False)]}"/>
<field name="glb_url" widget="Viewer3D" attrs="{'invisible': [('glb_url', '=', False)]}"/>
</group> </group>
<group> <group>
<field name="part_name"/> <field name="part_name"/>

View File

@@ -248,6 +248,7 @@ class ResaleOrderLine(models.Model):
# part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True) # part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True)
part_name = fields.Char('零件名称', related='product_id.part_name', readonly=True) part_name = fields.Char('零件名称', related='product_id.part_name', readonly=True)
model_glb_file = fields.Binary('模型的glb文件', compute='_compute_model_glb_file', store=True) model_glb_file = fields.Binary('模型的glb文件', compute='_compute_model_glb_file', store=True)
glb_url = fields.Char('glb文件地址', compute='_compute_model_glb_file', store=True)
# product_template_id = fields.Many2one( # product_template_id = fields.Many2one(
# string="产品", # string="产品",
# comodel_name='product.template', # comodel_name='product.template',
@@ -265,7 +266,6 @@ class ResaleOrderLine(models.Model):
embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余') embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余')
manual_quotation = fields.Boolean('人工编程', default=False) manual_quotation = fields.Boolean('人工编程', default=False)
model_url = fields.Char('模型文件地址') model_url = fields.Char('模型文件地址')
glb_url = fields.Char('glb文件地址')
model_id = fields.Char('模型id') model_id = fields.Char('模型id')
@api.depends('embryo_redundancy_id') @api.depends('embryo_redundancy_id')
@@ -279,6 +279,8 @@ class ResaleOrderLine(models.Model):
if line.product_template_id: if line.product_template_id:
if not line.model_glb_file: if not line.model_glb_file:
line.model_glb_file = line.product_id.product_tmpl_id.model_file line.model_glb_file = line.product_id.product_tmpl_id.model_file
if not line.glb_url:
line.glb_url = line.product_id.product_tmpl_id.glb_url
if not line.price_unit: if not line.price_unit:
line.price_unit = line.product_id.product_tmpl_id.list_price line.price_unit = line.product_id.product_tmpl_id.list_price

View File

@@ -50,9 +50,13 @@
<group> <group>
<field name="customer_id" context="{'is_customer': True }" <field name="customer_id" context="{'is_customer': True }"
options="{'no_create': True}" required="1"/> options="{'no_create': True}" required="1"/>
<field name="upload_model_file" widget="many2many_binary"/> <field name="upload_model_file" widget="many2many_binary" attrs="{'invisible': [('upload_model_file', '=', False)]}"/>
<!-- <field name="model_url" widget="binary_download" filename_field="model_name" readonly="1" string="模型文件"
attrs="{'invisible': [('model_url', '=', False)]}"/> -->
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1" <field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': [('model_file', '=', False)]}"/> attrs="{'invisible': [('model_file', '=', False)]}"/>
<!-- <field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
attrs="{'invisible': [('glb_url', '=', False)]}"/> -->
<label for="model_length" string="尺寸(mm)" <label for="model_length" string="尺寸(mm)"
attrs='{"invisible": [("model_file","=",False)]}'/> attrs='{"invisible": [("model_file","=",False)]}'/>
<div class="test_model" <div class="test_model"