Hello everyone,
I was using the presentation from the Odoo
Experience 2018 as basis for creating a new view type from scratch (link
below), but it seems it is not compatible anymore with the current
version 14.
https://www.youtube.com/watch?v=SIoljYJhTqk
I get the following error when installing the example module provided ( download from https://github.com/Polymorphe57/hello_world_view_code ):
"ValueError: ir.actions.act_window.view.view_mode: required selection fields must define an ondelete policy that implements the proper cleanup of the corresponding records upon module uninstallation. Please use one or more of the following policies: 'set default' (if the field has a default defined), 'cascade', or a single-argument callable where the argument is the recordset containing the specified option."
It seems like the code to add the new view in the available view modes is not compatible anymore, due to it being a selection field with required argument set to True, but without any ondelete argument set. When adding the new view with following code it will not work:
class ActWindowView(models.Model):
_inherit = 'ir.actions.act_window.view'
view_mode = fields.Selection(selection_add=[('hello_world', "Hello World")])
PS: I also tried adding the 'ondelete' argument together with the 'selection_add', but it also fails. I tried ondelete='set null' and ondelete='cascade'. Neither option worked.
Can anyone point me to the right direction to solve this OR show the correct way to implement a new view from scratch compatible with odoo 14?
Thanks in advance!
PS: Even in the Odoo official documentation they explain it like this, but it seems like it does not work with version 14 ( https://www.odoo.com/documentation/14.0/reference/javascript_cheatsheet.html#creating-a-new-view-from-scratch )
Hi,
I guess you are facing trouble while adding a selection field. Hope this video helps you,
https://www.youtube.com/watch?v=4tlfzy-ZtMQ&vl=en
Thanks