修复工作中心绑定机床和胚料外协供应商是否外包未勾选bug修复
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from. import product_template
|
||||
from. import product_supplierinfo
|
||||
|
||||
|
||||
|
||||
|
||||
11
sf_dlm/models/product_supplierinfo.py
Normal file
11
sf_dlm/models/product_supplierinfo.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class ResSupplierInfo(models.Model):
|
||||
_inherit = 'product.supplierinfo'
|
||||
|
||||
def _compute_is_subcontractor(self):
|
||||
for supplier in self:
|
||||
boms = supplier.product_id.variant_bom_ids
|
||||
boms |= supplier.product_tmpl_id.bom_ids.filtered(lambda b: not b.product_id or b.product_id in (supplier.product_id or supplier.product_tmpl_id.product_variant_ids))
|
||||
supplier.is_subcontractor = supplier.partner_id in boms.subcontractor_id
|
||||
@@ -82,7 +82,7 @@ class ResProductTemplate(models.Model):
|
||||
item['model_height'] + model_type.embryo_tolerance),
|
||||
'model_type_id': model_type.id,
|
||||
'model_processing_panel': 'R',
|
||||
'model_machining_precision': item['model_machining_precision'],
|
||||
'model_machining_precision': item['model_machining_precision'],
|
||||
'model_code': item['barcode'],
|
||||
'length': item['model_long'],
|
||||
'width': item['model_width'],
|
||||
@@ -92,7 +92,7 @@ class ResProductTemplate(models.Model):
|
||||
'model_name': attachment.name,
|
||||
'upload_model_file': [(6, 0, [attachment.id])],
|
||||
# 'single_manufacturing': True,
|
||||
'tracking': 'serial',
|
||||
# 'tracking': 'serial',
|
||||
'list_price': item['price'],
|
||||
# 'categ_id': self.env.ref('sf_dlm.product_category_finished_sf').id,
|
||||
'materials_id': self.env['sf.production.materials'].search(
|
||||
@@ -158,14 +158,13 @@ class ResProductTemplate(models.Model):
|
||||
'active': True
|
||||
}
|
||||
# 外协和采购生成的胚料需要根据材料型号绑定供应商
|
||||
if route_type == 'subcontract':
|
||||
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})]
|
||||
elif route_type == 'purchase':
|
||||
if route_type == 'subcontract' or 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})]
|
||||
if route_type == 'subcontract':
|
||||
partner = self.env['res.partner'].search([('id', '=', supplier.partner_id.id)])
|
||||
partner.is_subcontractor = True
|
||||
no_bom_copy_product_id.write(vals)
|
||||
logging.info('no_bom_copy_product_id-vals:%s' % vals)
|
||||
# product_id.product_tmpl_id.active = False
|
||||
@@ -249,7 +248,6 @@ class ResMrpBom(models.Model):
|
||||
[('materials_model_id', '=', materials_type.id)],
|
||||
limit=1,
|
||||
order='sequence asc')
|
||||
logging.info('get_supplier-vals:%s' % seller_id)
|
||||
return seller_id
|
||||
|
||||
# 匹配bom
|
||||
|
||||
Reference in New Issue
Block a user