增加坯料冗余量
This commit is contained in:
@@ -34,6 +34,9 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
|
||||
if kw.get('logistics_way'):
|
||||
order_id.logistics_way = kw['logistics_way']
|
||||
for item in bfm_process_order_list:
|
||||
if item.get('embryo_redundancy_id'):
|
||||
item['embryo_redundancy'] = request.env['sf.embryo.redundancy'].sudo().search([('code', '=', item['embryo_redundancy_id'])], limit=1)
|
||||
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)
|
||||
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
|
||||
|
||||
@@ -8,7 +8,7 @@ class ProductTemplate(models.Model):
|
||||
|
||||
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 = item['is_incoming_material']
|
||||
product_id.product_tmpl_id.is_customer_provided = True if item['embryo_redundancy_id'] else False
|
||||
return product_id
|
||||
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ class SaleOrder(models.Model):
|
||||
'model_width': product.width,
|
||||
'model_height': product.height,
|
||||
'price': product.list_price,
|
||||
'embryo_redundancy_id': line.embryo_redundancy_id,
|
||||
}
|
||||
# 获取成品名结尾-n的n
|
||||
product_seria = int(product.name.split('-')[-1])
|
||||
@@ -66,7 +67,7 @@ class SaleOrder(models.Model):
|
||||
bom.with_user(self.env.ref("base.user_admin")).bom_create_line_has(bom_data)
|
||||
else:
|
||||
# 当成品上带有客供料选项时,生成坯料时选择“客供料”路线
|
||||
if line.is_incoming_material:
|
||||
if line.embryo_redundancy_id:
|
||||
# 将成品模板的内容复制到成品上
|
||||
customer_provided_embryo = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_embryo_customer_provided').sudo()
|
||||
# 创建坯料,客供料的批量不需要创建bom
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
|
||||
<record id="sale.action_quotations_with_onboarding" model="ir.actions.act_window">
|
||||
<field name="search_view_id" ref="jikimo_sale_order_view_search_inherit_quotation_supply_method"/>
|
||||
<field name="context">{'search_default_draft': 1}</field>
|
||||
</record>
|
||||
|
||||
<record id="action_quotations_supply_method" model="ir.actions.act_window">
|
||||
|
||||
@@ -251,3 +251,6 @@ access_sf_cutting_tool_type_group_plan_dispatch,sf_cutting_tool_type_group_plan_
|
||||
|
||||
access_sf_machining_accuracy,sf_machining_accuracy,model_sf_machining_accuracy,base.group_user,1,0,0,0
|
||||
access_sf_machining_accuracy_admin,sf_machining_accuracy_admin,model_sf_machining_accuracy,base.group_system,1,0,0,0
|
||||
|
||||
access_sf_embryo_redundancy,sf_embryo_redundancy,model_sf_embryo_redundancy,base.group_user,1,0,0,0
|
||||
access_sf_embryo_redundancy_admin,sf_embryo_redundancy_admin,model_sf_embryo_redundancy,base.group_system,1,0,0,0
|
||||
|
||||
|
@@ -850,14 +850,19 @@ class ResProductMo(models.Model):
|
||||
copy_product_id.product_tmpl_id.active = True
|
||||
model_type = self.env['sf.model.type'].search([], limit=1)
|
||||
attachment = self.attachment_create(item['model_name'], item['model_data'])
|
||||
# 获取坯料冗余配置
|
||||
if not item.get('embryo_redundancy'):
|
||||
embryo_redundancy_id = self.env['sf.embryo.redundancy'].search([('name', '=', '粗坯料')], limit=1)
|
||||
else:
|
||||
embryo_redundancy_id = item.get('embryo_redundancy')
|
||||
vals = {
|
||||
'name': '%s-%s-%s' % ('P', order_id.name, i),
|
||||
'model_long': item['model_long'] + model_type.embryo_tolerance,
|
||||
'model_width': item['model_width'] + model_type.embryo_tolerance,
|
||||
'model_height': item['model_height'] + model_type.embryo_tolerance,
|
||||
'model_volume': (item['model_long'] + model_type.embryo_tolerance) * (
|
||||
item['model_width'] + model_type.embryo_tolerance) * (
|
||||
item['model_height'] + model_type.embryo_tolerance),
|
||||
'model_long': item['model_long'] + embryo_redundancy_id.long,
|
||||
'model_width': item['model_width'] + embryo_redundancy_id.width,
|
||||
'model_height': item['model_height'] + embryo_redundancy_id.height,
|
||||
'model_volume': (item['model_long'] + embryo_redundancy_id.long) * (
|
||||
item['model_width'] + embryo_redundancy_id.width) * (
|
||||
item['model_height'] + embryo_redundancy_id.height),
|
||||
'product_model_type_id': model_type.id,
|
||||
'model_processing_panel': item['processing_panel_detail'],
|
||||
'model_machining_precision': item['model_machining_precision'],
|
||||
@@ -933,6 +938,11 @@ class ResProductMo(models.Model):
|
||||
# surface_technology = self.env['stock.route'].sudo().search([('name', '=', '表面工艺外协')])
|
||||
# if surface_technology:
|
||||
# no_bom_copy_product_id.route_ids |= surface_technology
|
||||
# 获取坯料冗余配置
|
||||
if not item.get('embryo_redundancy_id'):
|
||||
embryo_redundancy_id = self.env['sf.embryo.redundancy'].search([('name', '=', '粗坯料')], limit=1)
|
||||
else:
|
||||
embryo_redundancy_id = item.get('embryo_redundancy_id')
|
||||
no_bom_copy_product_id.product_tmpl_id.active = True
|
||||
logging.info('no_bom_copy_product_id[is_manual_processing]:%s' % no_bom_copy_product_id.is_manual_processing)
|
||||
materials_id = self.env['sf.production.materials'].search(
|
||||
@@ -945,15 +955,15 @@ class ResProductMo(models.Model):
|
||||
vals = {
|
||||
'name': '%s-%s-%s [%s %s-%s * %s * %s]' % ('R',
|
||||
order_id.name, i, materials_id.name, materials_type_id.name,
|
||||
item['model_long'] + model_type.embryo_tolerance,
|
||||
item['model_width'] + model_type.embryo_tolerance,
|
||||
item['model_height'] + model_type.embryo_tolerance),
|
||||
'length': item['model_long'] + model_type.embryo_tolerance,
|
||||
'width': item['model_width'] + model_type.embryo_tolerance,
|
||||
'height': item['model_height'] + model_type.embryo_tolerance,
|
||||
'volume': (item['model_long'] + model_type.embryo_tolerance) * (
|
||||
item['model_width'] + model_type.embryo_tolerance) * (
|
||||
item['model_height'] + model_type.embryo_tolerance),
|
||||
item['model_long'] + embryo_redundancy_id.long,
|
||||
item['model_width'] + embryo_redundancy_id.width,
|
||||
item['model_height'] + embryo_redundancy_id.height),
|
||||
'length': item['model_long'] + embryo_redundancy_id.long,
|
||||
'width': item['model_width'] + embryo_redundancy_id.width,
|
||||
'height': item['model_height'] + embryo_redundancy_id.height,
|
||||
'volume': (item['model_long'] + embryo_redundancy_id.long) * (
|
||||
item['model_width'] + embryo_redundancy_id.width) * (
|
||||
item['model_height'] + embryo_redundancy_id.height),
|
||||
'embryo_model_type_id': model_type.id,
|
||||
'list_price': item['price'],
|
||||
'materials_id': materials_id.id,
|
||||
|
||||
@@ -133,7 +133,7 @@ class ReSaleOrder(models.Model):
|
||||
'product_uom_qty': item['number'],
|
||||
'model_glb_file': base64.b64decode(item['model_file']),
|
||||
'remark': item.get('remark'),
|
||||
'is_incoming_material': item.get('is_incoming_material'),
|
||||
'embryo_redundancy_id': item.get('embryo_redundancy_id'),
|
||||
'manual_quotation': item.get('manual_quotation')
|
||||
}
|
||||
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
|
||||
@@ -175,7 +175,8 @@ class ResaleOrderLine(models.Model):
|
||||
check_status = fields.Selection(related='order_id.check_status')
|
||||
remark = fields.Char('备注')
|
||||
|
||||
is_incoming_material = fields.Boolean('客供料', default=False)
|
||||
# is_incoming_material = fields.Boolean('客供料', default=False)
|
||||
embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余')
|
||||
manual_quotation = fields.Boolean('人工编程', default=False)
|
||||
|
||||
@api.depends('product_template_id')
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<field name="name" widget="section_and_note_text" optional="show"
|
||||
string="参数说明(长/宽/高/体积/精度/材质)"/>
|
||||
<field name="manual_quotation" readonly="1"/>
|
||||
<field name="is_incoming_material" readonly="1"/>
|
||||
<field name="embryo_redundancy_id" readonly="1"/>
|
||||
</xpath>
|
||||
<field name="user_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
||||
@@ -167,7 +167,7 @@
|
||||
<!--新增带料字段-->
|
||||
<xpath expr="//field[@name='order_line']/form//group//group//field[@name='analytic_distribution']" position="after">
|
||||
<field name="manual_quotation" />
|
||||
<field name="is_incoming_material"/>
|
||||
<field name="embryo_redundancy_id"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user