Community: Framework mailing list archives

Re: One2many function field New API 8

Jean-Paul Robineau
- 07/28/2015 10:57:26
Dear Khalid

This is an example for you

future_action_ids = fields.One2many(compute=_get_records_actions, multi=True, comodel_name='vca.action_plan', string='Future actions')

     def _get_records_actions(self):
         l_ids = self.env['vca.action_plan'].search([('res_model','=',self._name),
                              ('res_id','in',[ for x in self]),
         for obj in self:
             obj.future_action_ids = [ for x in l_ids if x.action_plan_type.type_action=='direct' and]

as you can see the function returns a list of ids

best regards

From: Khalid LAKHSAM <>
To: Community: Framework <>
Sent: Tuesday, July 28, 2015 4:42 PM
Subject: One2many function field New API 8

Hi Community,

How to create a One2many with a functionnal field in new api 8 ?

Best regards.
Post to: