Я пытаюсь создать новое поле с обратным вызовом, определяющим его домен, как показано ниже:
Код: Выделить всё
settore_principale = fields.Many2one(
'res.partner.industry',
string="Settore",
domain=lambda self: self._compute_settore_domain() # I tried both with and without str()
)
def _compute_settore_domain(self):
domain = [('x_studio_settore_padre', '=', False)]
if self.x_studio_macrocategoria:
domain.append(('x_studio_macrocategoria', '=', self.x_studio_macrocategoria))
return domain # Return domain as a list of tuples, not string
@api.onchange('x_studio_macrocategoria')
def _onchange_macrocategoria(self):
return {'domain': {'settore_principale': self._compute_settore_domain()}}
Код: Выделить всё
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
UndefinedColumn: column res_partner.settore_principale does not exist
LINE 1: ...uid", "res_partner"."write_date" AS "write_date", "res_partn...
^
Может ли кто-нибудь помочь мне понять, что я делаю неправильно?
Заранее спасибо
Подробнее здесь: https://stackoverflow.com/questions/792 ... k-function
Мобильная версия