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)?
@Weblearns2 жыл бұрын
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 :)
@SamirSELLAMI2 жыл бұрын
@@Weblearns very clear explanation, thanks again !
@tborth4 жыл бұрын
Thanks brother
@abdoulayedabacoulibaly70593 жыл бұрын
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
@Weblearns3 жыл бұрын
Hi can you past here code instead of Float as compute field you didn't use correct?
@abdoulayedabacoulibaly70593 жыл бұрын
@@Weblearns here is my code class Invoice(models.Model): _inherit = 'account.invoice.line' qty_delivered = fields.Float('sale.order', 'Quantite Delivrer')
@Weblearns3 жыл бұрын
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
@abdoulayedabacoulibaly70593 жыл бұрын
@@Weblearns that works thanks can I contact you sometimes when I have a little problem and how?
@Weblearns3 жыл бұрын
Sure anytime you can contact me.
@decajohn67863 жыл бұрын
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.
@Weblearns3 жыл бұрын
Well odoo stores models in registry table, if you manually remove from psql definitely Odoo raise such error.
@decajohn67863 жыл бұрын
@@Weblearns you're right. we should remove it also from ir_model. thanks for the insight bro! I've learned so much from you :)
@decajohn67863 жыл бұрын
@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.
@Weblearns3 жыл бұрын
@@decajohn6786 Seems its ID issue not related inheritance issue.
@decajohn67863 жыл бұрын
@@Weblearns what do you mean? how to figure it out?
@raafatalnakar3 жыл бұрын
Where can we find the project file
@Weblearns3 жыл бұрын
Question not clear, which file you need ?
@raafatalnakar3 жыл бұрын
@@Weblearns school student project
@Weblearns3 жыл бұрын
@@raafatalnakar You mean which I am working on ? If yes you can use below link github.com/er-harsh-dhaduk/odoo-training
@raafatalnakar3 жыл бұрын
@@Weblearns Yes thank you
@tborth4 жыл бұрын
What need of @api.model
@Weblearns4 жыл бұрын
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.
@tborth4 жыл бұрын
@@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
@tborth4 жыл бұрын
@@Weblearns can you please elaborate model level
@Weblearns4 жыл бұрын
@@tborth Yes please stay tuned will have decorator part too here. will explain in detail.
@tborth4 жыл бұрын
@@Weblearns thanks brother
@kenzasouabni2 жыл бұрын
how "Tango' appears , it appear in mine " module.model.id "
@Weblearns2 жыл бұрын
Hi Kenza, Pls elaborate more with your doubt. Thank you,