1
votes

I have View that is accessed either from menu directly or from lead/opportunity form view. Now when you open such view it behaves the same.

When I open such view from menu. I want option create="false" to be enabled, to not allow create new records. But if do that, it also won't allow to create that record when it is access from lead/opportunity form views.

I read that there is no way to copy view (but that was said like more than few years ago - OpenERP always displays inherited view instead of original) - like you can copy model and use it as new without changing anything for old one.

Example

To better understand what I mean you can read that link I provided or look at this example (its not for view, but for Odoo model. Well the principle is the same):

from openerp import models
class my_model2(models.Model):
    _name = 'my.model2'
    _inherit = 'my.model1'

This way it creates new model, copies everything from my.model1 had. And If I add anything new to my.model2 it won't affect my.model1. Thats what want to do with views, but I don't know if it is even possible (on version 8.0)

The only way I see now is just to do hard copy of that view or in other way - duplicate view. But that is not good practice at all, because if I would need to change anything in one view, most probably I would need to do in duplicate and so on..

1

1 Answers

0
votes

this Odoo inheritance is correct:

from openerp.models import Model
class MyModel(Model):
    _name = 'My.Model'
    _inherit = 'res.user'

In the last example you are creating a new Object that inherit to res.user.

the different openerp model inheritance mechanisms whats the difference between them and when shouldthey be used

Building a backend module