Skip to Content
Menú
This question has been flagged
2 Respostes
6448 Vistes

I got to this error showing as

Odoo Warning - Validation Error

The operation cannot be completed, probably due to the following:-
                deletion: you may be trying to delete a record while other records still reference it-
                creation/update: a mandatory field is not correctly set

[object with reference: cname - cname]

Here is the small line of code can anyone point that and say me the issue regarding this and how it can be solved
 
class productSpecificationNew(models.Model):        
        _name= 'product.specification.new'                
        name = fields.Char()        
        pname= fields.Many2one('product.product',string= 'Product Name')        
        cname= fields.Many2many('res.partner', string= 'Customer Name')        
        spec_table= fields.One2many('specification.table','spec')

class productSpecificationtable(models.Model):        
        _name = 'specification.table'                
        spec= fields.Many2one('product.specification',string= 'Specification')        
        parameter= fields.Char(string= 'Parameters')        
        perorval= fields.Float(string= '% or VALUE')        
        min= fields.Float(string= 'STD. Min.')        
        max= fields.Float(string= 'STD. Max.')        
        remarks= fields.Text(string= 'Remarks')


Thanks in Advance
.

Avatar
Descartar

You should upvote the answer and mark it as answered as a "thank you".

Best Answer

Hello, 

You try:  cname= fields.Many2many('res.partner', 'product_specification_partner_tb_rel', 'product_specification_id', 'partner_id', string= 'Customer Name').

Many2many will create table product_specification_partner_tb_rel with key product_specification_id, partner_id

Hope it will helps you.

Thanks,

Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de febr. 24
26
2
de des. 19
8872
0
de des. 19
4472
0
de nov. 19
4080
5
de set. 19
11680