コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4539 ビュー

I want to edit some models trough inheriting. I don't know which methods I need to implement. I saw in other modules that there are methods like copy, on_create, etc. Can anyone help me?

アバター
破棄

Nemanja, this purely depends on the model you want to use. You want _inherit or _ineherits? Specify your question in a little detailed manner.

著作者

I know the difference between _inherit and _inherits, it's written in technical memento. I need help with understanding basics of writing new model or inheriting existing. Under basic I meen which methods I need to implement for my model. For example I have model people, and when my user click Save on adequate view I need to write data to few other tables, of course based on data that my user entered. How can I catch this event, and how can I achieve this?

_inherit seems right for you. Which methods to override depends on your need. create() for creatin new record, write() for updating data of record, unlink() when you remove that record! fields_view_get() when you want to alter the view archirecture dyamically!

最善の回答

Basically you only need to override methods that you would like to use. If you for example only want to add fields, you can just define them. If you want something done when saving or creating a record, you need to inherit the appropriate method. Every object has a set of methods which are defined here:

https://doc.odoo.com/trunk/server/api_models/ (as soon as it gets back online)

アバター
破棄
著作者

Can you give me an example of overridden create method?

関連投稿 返信 ビュー 活動
0
3月 15
4252
5
7月 18
23421
0
4月 15
3437
3
7月 18
3811
1
3月 16
5933