This question has been flagged
2 Replies
5574 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

Avatar
Discard
Author Best Answer

hi

i have this error


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

TypeError: unhashable type: 'list'

Avatar
Discard

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

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

Best Answer

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.


Avatar
Discard