Different types of inheritance in Odoo | Types of inheritance | Delegation inheritance

  Рет қаралды 7,428

WebLearns

WebLearns

Күн бұрын

Пікірлер: 40
@jamesT008
@jamesT008 3 жыл бұрын
Very good explanation
@SamirSELLAMI
@SamirSELLAMI 2 жыл бұрын
Thanks for this informative practical explanation. Plz, I have a question regarding methods when using inheritance. As I understood from odoo docs when using the “inherits” (delegation or multiples inheritance) methods of the base model will not be inherited right ? Now when using classical inheritance “inherit” with new _name metadata, should we necessarily use “Super” to inherit methods of the base model or they will be automatically inherited, which mean they gonna work in views (ex. a method that compute a field in the base model)?
@Weblearns
@Weblearns 2 жыл бұрын
if you will call super statement in your method, It means it will auto call parent method or which you already inherited the same model's method. Again its not necessary to call super statement until unless you want to execute parent method's code :)
@SamirSELLAMI
@SamirSELLAMI 2 жыл бұрын
@@Weblearns very clear explanation, thanks again !
@tborth
@tborth 4 жыл бұрын
Thanks brother
@abdoulayedabacoulibaly7059
@abdoulayedabacoulibaly7059 3 жыл бұрын
Hi, I try to inherit the qty_delivered field in sale to the invoice but when I make a sale, the qty_delivered field does not automatically retrieve the value but offers me a drop-down list. I need a little help
@Weblearns
@Weblearns 3 жыл бұрын
Hi can you past here code instead of Float as compute field you didn't use correct?
@abdoulayedabacoulibaly7059
@abdoulayedabacoulibaly7059 3 жыл бұрын
@@Weblearns here is my code class Invoice(models.Model): _inherit = 'account.invoice.line' qty_delivered = fields.Float('sale.order', 'Quantite Delivrer')
@Weblearns
@Weblearns 3 жыл бұрын
Try this field qty_delivered = fields.Float(compute='get_qty', string='Quantite Delivrer') def get_qty(self): for line in self: total_qty = 0.0 for sol in line.sale_line_ids: total_qty += sol.qty_delivered line.qty_delivered = total_qty
@abdoulayedabacoulibaly7059
@abdoulayedabacoulibaly7059 3 жыл бұрын
@@Weblearns that works thanks can I contact you sometimes when I have a little problem and how?
@Weblearns
@Weblearns 3 жыл бұрын
Sure anytime you can contact me.
@decajohn6786
@decajohn6786 3 жыл бұрын
I am using inherit option 2 above. when I remove inherit, then upgrade the module, it caused error..KeyError: 'model name', eventhough I have removed the table in psql.
@Weblearns
@Weblearns 3 жыл бұрын
Well odoo stores models in registry table, if you manually remove from psql definitely Odoo raise such error.
@decajohn6786
@decajohn6786 3 жыл бұрын
@@Weblearns you're right. we should remove it also from ir_model. thanks for the insight bro! I've learned so much from you :)
@decajohn6786
@decajohn6786 3 жыл бұрын
@WebLearns I have tried using second type of inherit (started from minute 18:57), but it raised error : psycopg2.errors.UndefinedColumn: column "teacher_id" referenced in foreign key constraint does not exist.
@Weblearns
@Weblearns 3 жыл бұрын
@@decajohn6786 Seems its ID issue not related inheritance issue.
@decajohn6786
@decajohn6786 3 жыл бұрын
@@Weblearns what do you mean? how to figure it out?
@raafatalnakar
@raafatalnakar 3 жыл бұрын
Where can we find the project file
@Weblearns
@Weblearns 3 жыл бұрын
Question not clear, which file you need ?
@raafatalnakar
@raafatalnakar 3 жыл бұрын
@@Weblearns school student project
@Weblearns
@Weblearns 3 жыл бұрын
@@raafatalnakar You mean which I am working on ? If yes you can use below link github.com/er-harsh-dhaduk/odoo-training
@raafatalnakar
@raafatalnakar 3 жыл бұрын
@@Weblearns Yes thank you
@tborth
@tborth 4 жыл бұрын
What need of @api.model
@Weblearns
@Weblearns 4 жыл бұрын
api.model is decorator and it is a record-style method where self is a recordset, but its contents is not relevant, only the model or single recordset Best example is while you override the create method you need this decorator as its only model level used in case you forgot to add this decorator to any method then it will auto convert into api.multi decorator, and for create method it will convert into api.model_create_multi this decorator. Hope it will help you to understand this decorator.
@tborth
@tborth 4 жыл бұрын
@@Weblearns can you please example me different b/w if write method have @api.model and if don't have @api.model what will happen with the self , please help
@tborth
@tborth 4 жыл бұрын
@@Weblearns can you please elaborate model level
@Weblearns
@Weblearns 4 жыл бұрын
@@tborth Yes please stay tuned will have decorator part too here. will explain in detail.
@tborth
@tborth 4 жыл бұрын
@@Weblearns thanks brother
@kenzasouabni
@kenzasouabni 2 жыл бұрын
how "Tango' appears , it appear in mine " module.model.id "
@Weblearns
@Weblearns 2 жыл бұрын
Hi Kenza, Pls elaborate more with your doubt. Thank you,
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
How to use fields_view_get method in Odoo | Odoo ORM Methods
27:40
DHH discusses SQLite (and Stoicism)
54:00
Aaron Francis
Рет қаралды 108 М.
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 294 М.
Israel Has The Right To Defend Itself | Stand-up Comedy by Daniel Fernandes
15:07
How to use ensure_one method in Odoo | Odoo ORM Methods
8:42
WebLearns
Рет қаралды 2,9 М.
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН