Extend model example.
parent
fc3aa08222
commit
60503a606e
|
@ -33,16 +33,28 @@ Development
|
||||||
To develop a module based on this one:
|
To develop a module based on this one:
|
||||||
|
|
||||||
* See module ``product_multi_image`` as an example.
|
* See module ``product_multi_image`` as an example.
|
||||||
|
|
||||||
* You have to inherit model ``base_multi_image.owner`` to the model that needs
|
* You have to inherit model ``base_multi_image.owner`` to the model that needs
|
||||||
the gallery::
|
the gallery::
|
||||||
|
|
||||||
class MyOwner(models.Model):
|
class MyOwner(models.Model):
|
||||||
_name = "mymodule.name"
|
_name = "my.model.name"
|
||||||
_inherit = "base_multi_image.owner"
|
_inherit = ["my.model.name", "base_multi_image.owner"]
|
||||||
|
|
||||||
# If you need this, you will need ``post_init_hook_for_submodules``
|
# If you need this, you will need ``post_init_hook_for_submodules``
|
||||||
old_image_field = fields.Binary(related="image_main", store=False)
|
old_image_field = fields.Binary(related="image_main", store=False)
|
||||||
|
|
||||||
|
* Somewhere in the owner view, add::
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_ids"
|
||||||
|
nolabel="1"
|
||||||
|
context="{
|
||||||
|
'default_owner_model': 'my.model.name',
|
||||||
|
'default_owner_id': id,
|
||||||
|
}"
|
||||||
|
mode="kanban"/>
|
||||||
|
|
||||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
:target: https://runbot.odoo-community.org/runbot/149/8.0
|
:target: https://runbot.odoo-community.org/runbot/149/8.0
|
||||||
|
|
Loading…
Reference in New Issue