Skip to Content
Menu
This question has been flagged
2140 Views

I have a model with 2 field:

class res_partner(orm.Model):
    _inherit='res.partner'
    _columns={
        'expl_tour1':fields.many2one('member.formation.step', 'Tour 1'),
        'fast_assign':fields.many2one('member.formation.step', "Valeur d'assignation rapide"),
def fast_assign_exploitation(self,cr,uid,ids,context=None):
        expl_tour1 = fast_assign

And min my view I have a button:

<button name="fast_assign_exploitation" type="object" string="Assignation rapide" class="oe_edit_only" />


But when I click the button, I have an error:

  File "/var/packages/Odoo8/target/addons/member_formation/member_formation.py", line 70, in fast_assign_exploitation
    expl_tour1 = self.fast_assign
  File "/usr/local/lib/python2.7/site-packages/openerp/fields.py", line 701, in __get__
    record.ensure_one()
  File "/usr/local/lib/python2.7/site-packages/openerp/models.py", line 5146, in ensure_one
    if len(self) == 1:
  File "/usr/local/lib/python2.7/site-packages/openerp/models.py", line 5330, in __len__
    return len(self._ids)
AttributeError: 'res.partner' object has no attribute '_ids'

I just want to copy the value of the field fast_assign in the fieldexpl_tour1. Do you know how?

Avatar
Discard