I could only find res.users
Are there any other examples ?
By "with delegation" I mean with _inherits, not with _inherit
You can find only res.users in all Odoo community code as delegation inheritance from res.partner
You can check the GitHub example for delegation inheritance from res.partner
Related
I need some help.
I'm writing class diagrams for my engineering software course and I have some doubt.
With few words, this app will send a trouble ticket about a gas loss e.g.
I have a class called "ManageTroublTicket" and I need some methods to delete or modify the ticket for example.
I already have a ticket class, so ManageTroubleTicket will have a ticket object as attribute, but for the rest?
Should I create a class for "DeleteTicket" and extends with ManageTroubleTIcket?
Like
Class DeleteTicket extends ManageTroubleTicket?
Or something like
Class ManageTroubleTicket implements DeleteTicket?
What kind of strategy should I use?
Thanks for answering and sorry for my bad english
I have a custom model mymodule.contacts which inherits from res.partner because I new a few extra fields. I would like my records that I add to mymodule.contacts to be visible in the other Odoo modules, sans my extra fields .. i.e. the fields in my model which inherit from res.partner are the only ones that possibly could be visible in the other Odoo models and that's fine. so for example, the Invoice module uses the res.partner model. My model inherits from res.partner. However since Odoo should create my model as a new table in Postgres, I dont think any of my contact data in my custom model will be visible to the Invoices module, despite inheriting from res.partner, because the actual data is in a different Postgres table. Are my assumptions correct?
It really depends on the kind of inheritance you're doing. If you do a simple inheritance with
_inherit = res.partner
To add new fields to the res.partner model, then Yes the new fields would be available to any model that has links to res.partner
On the other hand if you do a polymorphic inheritance with
_inherits = res.partner
Or you specify a _name while inheriting, A new table would be created in postgres with the attributes of the old model and your new fields won't be available to other models that inherit res.partner.
I think what you're really looking for is _inherits, it creates a new table for you. The default data for res.partner would still be stored in it's table but the new data would be stored in the new table you specified, so other models would never get to know of the new fields you added.
There is a great visualization here on the types of inheritance in Odoo.
https://www.odoo.com/forum/how-to/developers-13/whats-the-difference-between-inherit-and-inherits-52205
When you inherit a model, you simply gain its characteristics so that you can build on it. The inherited model or any other model will not have any visibility to your model unless its connected. The extra fields you add to your extension model will not be visible to any other model unless you connect them with many2one ,one2many or many2many fields.
While exploring basic Object Oriented Design principles I was wondering: What is the correct term for an 'overridden' class attribute in a child class?
I believe it's just that: an overridden property/attribute. I don't think it has a specific term.
I'm designing a class hierarchy for a Java Project. It involves creating a class hierarchy to represent several bank accounts.
Now, all bank accounts have a few attributes in common. These can be moved to an abstract class. However, there is one attribute which is common to several of the bank accounts but not all of them. How should I implement this attribute in the class hierarchy?
I probably shouldn't implement the attribute over and over in all the relevant classes but I can't think of another way to do it..
Let me try and help you out as much as possible.
You can have an interface IBankAccount, which defines the common behavior of the Bank Accounts. There will be just method definitions. E.g. A bank account should allow credit(), debit(), getBalance() etc. methods. It can have some additional methods not so common to all Bank Accounts.
Next you can have a BaseBankAccount class that would be abstract and implement these commmon methods. This is so because credit(), debit() and getBalance() will have a common behavior across bank accounts.
Then you can define a BankDecorator interface that will define BankAccount behaviors. Special Decorators will implement this interface to add extra features to the bank accounts. E.g. CurrentBankAccountDecorator will add the Current account functionality etc.
Hope this helps.
You could use the programming concept of mixins.
See also: D. Ancona, G. Lagorio, and E. Zucca. Jam - designing a Java extension with
mixins. ACM Trans. Program. Lang. Syst., 25(5):641-712, 2003.
i have a custom type that implemented IUserType.
one of my domain classes have a property of this custom type.
now i want to make Automapping work with this domain, it says that "
An association from the table xyz refers to an unmapped class: PersianDate"
PersianDate is my custom type .
how should i tell to automapping that this is not a reference, it is a custom user type that is fitted into a string column !!!
i searched everything that was in the internet , i think there is something wrong here
would you please help me to fix it
i found the answer Here, i should use a UserTypeConvention in Automapping conventions