1.修复销售岗位创建快速订单没有生成销售订单问题2.工件配送Tree视图默认上产线
This commit is contained in:
@@ -17,7 +17,6 @@ from odoo.addons.sf_base.commons.common import Common
|
||||
from . import parser_and_calculate_work_time as pc
|
||||
|
||||
|
||||
|
||||
class QuickEasyOrder(models.Model):
|
||||
_name = 'quick.easy.order'
|
||||
_description = '简易下单'
|
||||
@@ -55,6 +54,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):
|
||||
@@ -89,7 +89,8 @@ class QuickEasyOrder(models.Model):
|
||||
obj = super(QuickEasyOrder, self).create(vals)
|
||||
# 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
|
||||
|
||||
|
||||
@@ -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('工厂创建销售订单和产品失败,请联系管理员')
|
||||
|
||||
@@ -141,6 +141,19 @@ class ResaleOrderLine(models.Model):
|
||||
model_glb_file = fields.Binary('模型的glb文件')
|
||||
check_status = fields.Selection(related='order_id.check_status')
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _compute_model_glb_file(self):
|
||||
for line in self:
|
||||
if line.product_template_id:
|
||||
if not line.model_glb_file:
|
||||
line.update({
|
||||
'model_glb_file': line.product_id.product_tmpl_id.model_file,
|
||||
})
|
||||
if not line.price_unit:
|
||||
line.update({
|
||||
'price_unit': line.product_id.product_tmpl_id.list_price,
|
||||
})
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
Reference in New Issue
Block a user