优化涉及到的接口
This commit is contained in:
@@ -17,11 +17,11 @@ class ResProductTemplate(models.Model):
|
||||
model_height = fields.Float('模型高[mm]', digits=(16, 3))
|
||||
model_volume = fields.Float('模型体积[m³]')
|
||||
model_machining_precision = fields.Selection([
|
||||
('±0.10mm', '±0.10mm'),
|
||||
('±0.05mm', '±0.05mm'),
|
||||
('±0.03mm', '±0.03mm'),
|
||||
('±0.02mm', '±0.02mm'),
|
||||
('±0.01mm', '±0.01mm')], string='加工精度')
|
||||
('0.10', '±0.10mm'),
|
||||
('0.05', '±0.05mm'),
|
||||
('0.03', '±0.03mm'),
|
||||
('0.02', '±0.02mm'),
|
||||
('0.01', '±0.01mm')], string='加工精度')
|
||||
model_type_id = fields.Many2one('sf.model.type', string='模型类型')
|
||||
model_processing_panel = fields.Char('模型加工面板')
|
||||
model_surface_process_id = fields.Many2one('sf.production.process', string='表面工艺')
|
||||
@@ -80,10 +80,9 @@ class ResProductTemplate(models.Model):
|
||||
'model_volume': (item['model_long'] + model_type.embryo_tolerance) * (
|
||||
item['model_width'] + model_type.embryo_tolerance) * (
|
||||
item['model_height'] + model_type.embryo_tolerance),
|
||||
'model_type_id': 1,
|
||||
# 'model_machining_precision': item['model_machining_precision'],
|
||||
'model_type_id': model_type.id,
|
||||
'model_processing_panel': 'R',
|
||||
'model_machining_precision': '±0.10mm',
|
||||
'model_machining_precision': item['model_machining_precision'],
|
||||
'model_code': item['barcode'],
|
||||
'length': item['model_long'],
|
||||
'width': item['model_width'],
|
||||
@@ -118,6 +117,7 @@ class ResProductTemplate(models.Model):
|
||||
attachment = self.env['ir.attachment'].create({
|
||||
'datas': base64.b64decode(data),
|
||||
'type': 'binary',
|
||||
'public': True,
|
||||
'description': '模型文件',
|
||||
'name': name
|
||||
})
|
||||
@@ -131,7 +131,6 @@ class ResProductTemplate(models.Model):
|
||||
[('materials_no', '=', item['texture_code'])])
|
||||
materials_type_id = self.env['sf.materials.model'].search(
|
||||
[('materials_no', '=', item['texture_type_code'])])
|
||||
model_type = self.env['sf.model.type'].search([], limit=1)
|
||||
supplier = self.env['mrp.bom'].get_supplier(materials_type_id)
|
||||
logging.info('no_bom_copy_product_supplier-vals:%s' % supplier)
|
||||
vals = {
|
||||
@@ -162,12 +161,10 @@ class ResProductTemplate(models.Model):
|
||||
no_bom_copy_product_id.purchase_ok = True
|
||||
no_bom_copy_product_id.seller_ids = [
|
||||
(0, 0, {'partner_id': supplier.partner_id.id, 'delay': 1.0, 'is_subcontractor': True})]
|
||||
logging.info('no_bom_copy_product_id-seller_ids-vals:%s' % no_bom_copy_product_id.seller_ids)
|
||||
elif route_type == 'purchase':
|
||||
no_bom_copy_product_id.purchase_ok = True
|
||||
no_bom_copy_product_id.seller_ids = [
|
||||
(0, 0, {'partner_id': supplier.partner_id.id, 'delay': 1.0})]
|
||||
logging.info('no_bom_copy_product_id-seller_ids-vals:%s' % no_bom_copy_product_id.seller_ids)
|
||||
no_bom_copy_product_id.write(vals)
|
||||
logging.info('no_bom_copy_product_id-vals:%s' % vals)
|
||||
# product_id.product_tmpl_id.active = False
|
||||
|
||||
Reference in New Issue
Block a user