Odoo 도움말

0

0
1 응답
0
mitra safari Iran
19. 9. 23. 오전 8:28

I solve my problem with rewrite creat and write functions  like below :

in purchase.requisition.line  

_columns = {
'product_id': fields.many2one('product.product', 'Product' ),
'product_uom_id': fields.many2one('product.uom', 'Product UoM'),
'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM')),
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade'),
'company_id': fields.related('requisition_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True),
'categ' : fields.many2one('product.category', 'categ' ,store=True,readonly=True),
}

def write(self, cr, uid, ids, vals, context=None):
if vals.get('product_id'):
a= self.pool.get('product.product').browse(cr, uid, vals['product_id']).categ_id.id
vals.update({'categ': a})
return super(purchase_requisition_line, self).write(cr, uid, ids, vals, context=context)

def create(self, cr, uid, vals, context=None):
if vals.get('product_id'):
a= self.pool.get('product.product').browse(cr, uid, vals['product_id']).categ_id.id
vals.update({'categ': a})
return super(purchase_requisition_line, self).create(cr, uid, vals, context=context)

질문하기
Writer
Keep Informed
1 팔로워
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now