处理订单客供料的问题

This commit is contained in:
胡尧
2024-11-21 15:48:17 +08:00
parent 8c81315c33
commit 7408cc00f9
5 changed files with 4 additions and 7 deletions

View File

@@ -39,6 +39,7 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
item['embryo_redundancy_id'] = item['embryo_redundancy'].id
product = request.env['product.template'].sudo().product_create(product_id, item, order_id,
kw['order_number'], i)
product.product_tmpl_id.is_customer_provided = True if item['embryo_redundancy_id'] else False
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
i += 1
res['factory_order_no'] = order_id.name

View File

@@ -6,12 +6,6 @@ class ProductTemplate(models.Model):
is_manual_processing = fields.Boolean(string='人工线下加工')
is_customer_provided = fields.Boolean(string='客供料')
def product_create(self, product_id, item, order_id, order_number, i):
product_id = super(ProductTemplate, self).product_create(product_id, item, order_id, order_number, i)
product_id.product_tmpl_id.is_customer_provided = True if item['embryo_redundancy_id'] else False
return product_id
def copy_template(self, product_template_id):
if not isinstance(product_template_id, ProductTemplate):
raise ValueError('%s必须是ProductTemplate类型' % product_template_id)

View File

@@ -415,9 +415,9 @@ class ReSaleOrder(models.Model):
class EmbryoRedundancy(models.Model):
_name = "sf.embryo.redundancy"
code = fields.Char('编码', required=True)
name = fields.Char('名称', required=True)
long = fields.Float('长度(mm)', required=True)
width = fields.Float('宽度(mm)', required=True)
height = fields.Float('高度(mm)', required=True)
code = fields.Char('编码', required=True)
active = fields.Boolean('有效', default=True)

View File

@@ -19,6 +19,7 @@
<field name='part_name' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
<field name='part_number' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
<field name='manual_quotation' attrs="{'invisible':[('upload_model_file', '=', [])]}"/>
<field name="is_customer_provided" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])], 'readonly': True}" />
<field name="upload_model_file"
widget="many2many_binary"
attrs="{'invisible': ['|', '|',('categ_type', '!=', '成品'),('categ_type', '=', False),('is_bfm','=', True)]}"/>

View File

@@ -133,6 +133,7 @@ class ReSaleOrder(models.Model):
'product_uom_qty': item['number'],
'model_glb_file': base64.b64decode(item['model_file']),
'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')
}