1.修复销售岗位创建快速订单没有生成销售订单问题2.工件配送Tree视图默认上产线

This commit is contained in:
jinling.yang
2024-05-07 14:44:58 +08:00
parent ed41667477
commit b8196cc4a9
10 changed files with 53 additions and 12 deletions

View File

@@ -51,6 +51,7 @@ class QuickEasyOrder(models.Model):
('success', '成功'),
('fail', '失败')], string='模型上色状态')
processing_time = fields.Integer('加工时长(min)')
sale_order_id = fields.Many2one('sale.order', '销售订单号')
@api.depends('unit_price', 'quantity')
def _compute_total_amount(self):
@@ -79,12 +80,12 @@ class QuickEasyOrder(models.Model):
base64_datas = base64_data.decode('utf-8')
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
report_path = attachment._full_path(attachment.store_fname)
vals['model_file'] = self.transition_glb_file(report_path, model_code)
obj = super(QuickEasyOrder, self).create(vals)
logging.info('---------向cloud生成模型库记录-------')
self.model_coloring(obj)
logging.info('---------开始派单到工厂-------')
self.distribute_to_factory(obj)
sale_order = self.distribute_to_factory(obj)
obj.sale_order_id = sale_order.id
obj.state = '待接单'
return obj
@@ -264,6 +265,7 @@ class QuickEasyOrder(models.Model):
product_bom_purchase = self.env['mrp.bom'].bom_create(product, 'normal', False)
product_bom_purchase.bom_create_line_has(purchase_embryo)
order_id.with_user(self.env.ref("base.user_admin")).sale_order_create_line(product, item)
return order_id
except Exception as e:
# self.cr.rollback()
return UserError('工厂创建销售订单和产品失败,请联系管理员')