Community mailing list archives

community@mail.odoo.com

Re: Create function in crone

by
dom
- 04/10/2016 19:33:31

The error is a message generated by ensure_one

You don't need to ensure that the self is singleton by the way. You are not using this information on the code

On 11 Apr, 2016 5:48 am, "Yassine ISSAOUI" <yassine.trav@gmail.com> wrote:
Hello,

recently i try to run a cron in odoo 8, but a have a this error :              

File "/opt/odoo/openerp/models.py", line 5303, in ensure_one raise except_orm("ValueError", "Expected singleton: %s" % self) except_orm: ('ValueError', 'Expected singleton: atelier.material()')

My function : 
@api.model
 def create_action(self):
        self.ensure_one()
        ids = self.env['atelier.materiel'].search([])
        for m in ids:
            res = self.env['atelier.location.interne'].create({'materiel': m.code_mat})

Thanks.

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe