sync-addons
sync-addons copied to clipboard
sync: new parameter type - sync.project.odoo
class SyncProjectReference(models.Model):
_name = "sync.project.odoo"
_description = "Project References"
_inherit = "sync.project.param.mixin"
def _selection_ref_model(self):
self.ensure_one()
return [(self.model_id.model, self.model_id.name)]
def _get_value_domain(self):
self.ensure_one()
domain = # TODO convert self.domain from string to real domain
return domain
model_id = fields.Many2one()
model_name = fields.Char(realted='model_id.model')
domain = fields.Char()
value = fields.Reference(string='Record', selection=_selection_ref_model, domain=lambda s: s._get_value_domain)
<field name="value" />
<field name="model_id" groups="base.group_no_one" />
<field name="model_name" invisible="1" />
<field name="domain" widget="domain" options="{'model': 'model_name', 'in_dialog': True}" groups="base.group_no_one"/>
usage example: specify User or Group via reference widget rather than just putting ID
_name = `sync.param.value`
name = fields.Chart(translate=True) # user friendly value, e.g. "Red color"
key = fields.Char() # key to filter in sync.project.odoo
value = fields.Char() # code, e.g. "red"
- [ ] обновить экспорт проекта
Name in eval context (similar to params
, texts
, secrets
):
params_odoo
estimation: minimum 6 - expected 10 - maximum 16