Hi,
I want to use this inside a class model.TransientModel and this works fine with Odoo 8, but in 11 does not, it says that a arg is missing.
Can anyone help me to solve this ?
def _default_company(self):
"""Return user company our first found"""
user = self.pool.get('res.users').browse(self._cr, self._uid, self._uid)
if user.company_id:
return user.company_id.id
return self.pool.get('res.company').search([('parent_id', '=', False)])[0]
company_id = fields.Many2one(comodel_name="res.company", string="Companhia", required=True, default=_default_company, )
Thanks in advance,
Paulo
Can you explain in more detail what you mean with access to themeDisplay ?
I have a form definition that will use a many2one field called company_id, for the user to select from a combobox the name of the company if his using multi-company configuration.
in the python side I have class that is associated with this form, defined as models.TransientModel, since it's a temporary table.
So in this class I'm defining the field company_id, that is a Many2one field, they way I wrote before.
This addon was made for odoo 8, and fully working, so in this process of adaptation, I'm finding some issues as expected, and this one in particular, i bypassed it until now this way:
def _default_company(self):
"""Return user company id"""
company = self.company_id
return company
Thanks