TIP: You can type at any time to perform a new search.
Chained Swapper
chained_swapper · OCA/server-ux
- Repository
- OCA/server-ux · module folder · Try on Runboat
- Module version
- 1.0.0
- Category
- Tools
- Folder size
- 0.1 MB
- License
- AGPL-3
- Application
- No
- Auto-installable
- No
- Website
- https://github.com/OCA/server-ux
- Last tracking update
- 2026-08-07 08:42:53
- Authors
- Odoo Community Association (OCA), Tecnativa
- Maintainers
- Odoo Community Association (OCA), Tecnativa
- Committers
- Pedro M. Baeza, Weblate, OCA-git-bot, oca-ci, juancarlosonate-tecnativa
- Odoo dependencies
-
odoo/odoo:- base
- Python dependencies
- None
- System dependencies
- None
- Required by
- None
- Description
This module allows to swap the value of a field and propagate it in a chained way to linked records. Example: changing the delivery address in a confirmed sales order, it should be changed in its delivery orders as well. It also allows to apply constraints for not allowing to do that change according rules, so the business logic is not broken. Example: Don't allow to change the delivery address if the delivery order is validated. This module requires some technical knowledge for setting the chained swap and the constraint, as it's defined through technical names and Python code. **WARNING**: Use this module with care, as it can screw up database consistency if swaps are not properly designed .
Code Analysis ⓘ
Views touched (6)
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
chained_swapper_constraint_view_form |
chained.swapper.constraint.form | chained.swapper.constraint | form | New |
chained_swapper_constraint_view_tree |
chained.swapper.constraint.tree | chained.swapper.constraint | list | New |
chained_swapper_sub_field_view_tree |
chained.swapper.sub.field.tree | chained.swapper.sub.field | list | New |
chained_swapper_view_form |
chained.swapper.form | chained.swapper | form | New |
chained_swapper_view_tree |
chained.swapper.tree | chained.swapper | list | New |
chained_swapper_wizard_view_form |
chained.swapper.wizard.form | chained.swapper.wizard | form | New |
HTTP endpoints (0)
No HTTP endpoints found for this module.
Models touched (4)
New fields (8)
-
allowed_field_ids_domainBinarycompute='_compute_allowed_field_ids_domain' -
constraint_idsOne2many → chained.swapper.constraintcomodel_name='chained.swapper.constraint'inverse_name='chained_swapper_id'string='Constraints' -
field_idMany2one → ir.model.fieldscomodel_name='ir.model.fields'domain='allowed_field_ids_domain'ondelete='cascade'required=True -
group_idsMany2many → res.groupscolumn1='mass_id'column2='group_id'comodel_name='res.groups'relation='mass_group_rel'string='Groups' -
model_idMany2one → ir.modelcomodel_name='ir.model'help='Model is used for Selecting Field. This is editable until Contextual Action is not created.'ondelete='cascade'required=True -
nameCharindex=1required=Truetranslate=True -
ref_ir_act_window_idMany2one → ir.actions.act_windowcomodel_name='ir.actions.act_window'help='Action to make this template available on records of the related document model.'readonly=Truestring='Action' -
sub_field_idsOne2many → chained.swapper.sub.fieldcomodel_name='chained.swapper.sub.field'inverse_name='chained_swapper_id'string='Sub-fields'
-
add_action(self) -
unlink(self) -
unlink_action(self) -
write(self, vals)
New fields (3)
-
chained_swapper_idMany2one → chained.swappercomodel_name='chained.swapper'ondelete='cascade' -
expressionTextdefault='True'help="Boolean python expression. You can use the keyword 'records' as the records selected to execute the contextual action. Ex.: bool(records.mapped('parent_id'))"required=Truestring='Constraint expression' -
nameCharrequired=Truetranslate=True
No public methods.
New fields (3)
-
chained_swapper_idMany2one → chained.swappercomodel_name='chained.swapper'ondelete='cascade' -
model_nameCharrelated='chained_swapper_id.model_id.model'string='Model Name' -
sub_field_chainCharhelp="You can specify here a field of related fields as dotted names. Ex.: 'child_ids.lang'."required=True
No public methods.
New fields (1)
-
company_idMany2one → res.companydefault=<expr>string='Company' args: 'res.company'
-
change_action(self) -
create(self, vals_list)@api.model_create_multiAs we don't have any field in this model, the key-value pair received in vals dict are only used to change the value in the active models. -
default_get(self, fields)@api.model -
fields_get(self, allfields=None, attributes=None)@api.model -
get_view(self, view_id=None, view_type='form', **options)@api.modelAs we don't have any field in this model, result['fields'] and result['arch'] are modified to add dynamically the corresponding field. -
get_views(self, views, options=None)@api.model -
onchange(self, values, field_names, fields_spec) -
post_chained_swap(self, model, field_name, original_values, new_value)@api.model -
read(self, fields, load='_classic_read')Without this call, dynamic fields build by get_view() generate a crash and warning, i.e.: read() with unknown field 'myfield'
Loading…
Loading…
Loading…
Loading…
- Status
- Open migration PR — not merged yet for this version
- CI status
- checks failing
- Open since
- 84 days ago
- Last activity
- 84 days ago
- Repository
- OCA/server-ux
- Pull request
- [19.0][MIG] chained_swapper: Migration to 19.0 (#1297)