调整模型上传的流程

This commit is contained in:
胡尧
2025-02-20 13:36:05 +08:00
parent 8095a8a972
commit 05dac9fb0c
8 changed files with 66 additions and 40 deletions

View File

@@ -138,11 +138,14 @@ class ReSaleOrder(models.Model):
product.materials_id.name),
'price_unit': product.list_price,
'product_uom_qty': item['number'],
'model_glb_file': base64.b64decode(item['model_file']) if item['model_file'] else None,
# 'model_glb_file': base64.b64decode(item['model_file']) if item['model_file'] else None,
'model_url': item['model_url'],
'glb_url': item['glb_url'],
'remark': item.get('remark'),
'embryo_redundancy_id': item.get('embryo_redundancy_id'),
'is_incoming_material': True if item.get('embryo_redundancy_id') else False,
'manual_quotation': item.get('manual_quotation')
'manual_quotation': item.get('manual_quotation'),
'model_id': item['model_id'],
}
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
@@ -261,6 +264,9 @@ class ResaleOrderLine(models.Model):
is_incoming_material = fields.Boolean('客供料', compute='_compute_is_incoming_material', store=True)
embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余')
manual_quotation = fields.Boolean('人工编程', default=False)
model_url = fields.Char('模型文件地址')
glb_url = fields.Char('glb文件地址')
model_id = fields.Char('模型id')
@api.depends('embryo_redundancy_id')
def _compute_is_incoming_material(self):

View File

@@ -101,9 +101,9 @@
<!-- <field name="schedule_status" readonly="1"/> -->
</field>
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="before">
<field name="model_glb_file" widget="Viewer3D" optional="show"
string="模型文件" attrs="{'readonly': [('state', 'in', ['draft'])]}"/>
<field name="part_name" optional="hide"/>
<field name="glb_url" widget="Viewer3D" optional="show"
string="模型文件" readonly="1"/>
<field name="part_name" optional="show"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='price_subtotal']" position="after">
<field name="remark"/>