Odoo Help

0

insert values in many2many product.attribute

By
tarik lallouch
on 4/14/15, 3:36 AM 1,541 views

hi,

i want to insert values in product.template.attribute_line_ids. i try to insert 


line_id=self.pool.get('product.attribute.line').search(cr, uid,([('product_tmpl_id','=', product_tmpl_id),('attribute_id','=',modelcolor_id[0])])) 

if line_id:

values={'id':color_id, 'attribute_id': modelcolor_id[0],'name':color }

colors=line_id.value_id

self.pool.get('product.attribute.line').write(cr, uid,line_id ,{'value_ids': [(1, line_id, {values})]})


can you help me

0
tarik lallouch
On 4/14/15, 5:50 AM

hi

i have this error


env.prefetch[cls._name].update(ids)

TypeError: unhashable type: 'list'

Hi, I have updated my answer. Please try it.

Emipro Technologies Pvt. Ltd.
on 4/16/15, 2:06 AM
hi
thanks for your replay but i have this error

 File "/opt/openerp/odoo/openerp/models.py", line 3778, in _write

    raise MissingError(_('One of the records you are trying to modify has already been deleted (Document type: %s).') % self._description)

MissingError: ('MissingError', 'One of the records you are trying to modify has already been deleted (Document type: product.attribute.value).')


my code is: 

line_id=self.pool.get('product.attribute.line').search(cr, uid,([('product_tmpl_id','=', product_tmpl_id),('attribute_id','=',modelcolor_id[0])]))                                    

                                if line_id:

                                    values={'id':color_id, 'attribute_id': modelcolor_id[0],'name':color }

                                    self.pool.get('product.attribute.line').write(cr, uid,line_id ,{'value_ids': [(1, line_id[0], values ) ] })

thanks


Cordialement,


Tarik Sindi Lallouch
General Manager

PLVDESIGN - SPRINT
15 rue des Asphodeles
Casablanca - Maroc
tariklallouch@plvsprint.com

2015-04-16 7:06 GMT+01:00 Emipro Technologies Pvt. Ltd. <hiren@emiprotechnologies.com>:

Hi, I have updated my answer. Please try it.

Emipro Technologies is best in Odoo & eCommerce Application development based outsourcing software firm. We deliver any kind of complex solutions in the domain of Odoo and eCommerce to customers accross the globe. Being in IT business since 2011, We have a strong team of skilled experienced IT experts.Our customers are companies of all sizes ranging from startups to large enterprises who realize that they need a professional internet solution to generate revenue streams, establish communication channels or streamline business operations.

Our Services in Odoo includes,
  • Installation
  • Customization
  • Configuration
  • Software Training
  • After Sale Support
  • Maintenance
  • Consulting
Contact info@emiprotechnologies.com for any kind of queries in Odoo. Visit www.emiprotechnologies.com for more details.




 

Sent by Tiny ERP Pvt Ltd using Odoo access your messages

tariklallouch
on 4/16/15, 3:18 AM
0

Hi,

just update your last line with the following. 

self.pool.get('product.attribute.line').write(cr, uid,line_id ,{'value_ids': [(1, line_id[0], values ) ] }) # Here we have to pass dict and your values is it self dict. Here we just need to give one ID.

I hope issue will resolve.


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

Question tools

1 follower(s)

Stats

Asked: 4/14/15, 3:36 AM
Seen: 1541 times
Last updated: 4/14/15, 10:40 AM