-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADD] Developer: data module tutorial #11050
Conversation
Will need a new entry in codeowners ( |
dc9b746
to
0c95a70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff 👍
Just the style issue of putting id
first in the XML <record/>
s and some minor typos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really liked reading this tutorial, and learned a few tips in the process. Thanks @bouvyd!
No big comment (except maybe the one about store
default value). This can be merged as is.
Tiny last point: I don't know if this tutorial needs to be exhaustive, but maybe mentioning the following items, although a bit advanced wouldn't hurt:
- use of
<function/>
- add image/file as
ir.attachment
- add some JS like a tour
- add
ir.model.data
records to exclude from cloc
Cheers!
0c95a70
to
d234780
Compare
Hey there Thx for both your reviews!
Could be a good idea, though i have few useful examples and can't really think of one that makes sense in the context of the 'Real Estate' app. Even for industry modules, i'm not convinced it's a frequent need?
You mean like adding an image in a knowledge article, or an html description, etc.? Makes sense for your case; a bit less for a ps-tech training. Could actually be included in the 'define module data' imho.
Yes, i thought i included some info about including js files but apparently not. The tour seems like a simple enough example. (done)
Not sure this is something that should be included in a generic tutorial that is on the documentation website? Seems more like internal stuff 🤔 |
d234780
to
25abe54
Compare
25abe54
to
2999d88
Compare
@AntoineVDV my newbie will need this next week, if we can merge this week it would be swell anything missing on your end? any way i can help? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I learned a few things about data modules :)
- The tutorial could use fewer references to the Server framework 101 tutorial because it can and will change over time, and the references only remind the reader when they learned something, which I don't find worth maintaining.
- I pushed a fixup! commit with nitpicking/styling changes. Feel free to keep what you want and squash. In particular, I removed the exercise summaries you put as headers because they're not rendered as such but displayed in the body of the admonition. Also, they don't really add value IMHO.
@robodoo delegate+
It is also possible to deploy the module using the `odoo-bin` command line tool with the `deploy` | ||
command: | ||
|
||
.. code-block:: bash | ||
|
||
$ odoo-bin deploy <path_to_your_module> https://<your_odoo_instance> --login <your_login> --password <your_password> | ||
|
||
This command also accepts the `--force` option, which is equivalent to the `Force init` option | ||
in the wizard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be interesting to document these commands and options and reference them here with
:option:`--example <odoo-bin --example>`
for each field. For example, it is possible to set the default value of the | ||
``x_selling_price`` field to ``100000`` for all properties by creating the following record: | ||
|
||
.. code-block:: xml | ||
|
||
<odoo> | ||
<!-- ...model definition from before... --> | ||
<record id="default_real_estate_property_selling_price" model="ir.default"> | ||
<field name="field_id" ref="estate.field_real_estate_property_selling_price" /> | ||
<field name="json_value">100000</field> | ||
</record> | ||
</odoo> | ||
|
||
For more details, refer to the `ir.default` model in the database available in the | ||
:menuselection:`Settings --> Technical --> Actions --> User-defined Defaults` menu or | ||
see the `ir.default` model definition in the `base` module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this should rather be an exercise of the tutorial. The reader can use what they learned above and find the fields to populate to create the ir.default themselves.
.. note:: | ||
|
||
If your action needs to return an action to the client (for example to redirect the user to | ||
another view), you can assign it to a semi-magical ``action`` variable inside your server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super reassuring :D
another view), you can assign it to a semi-magical ``action`` variable inside your server | |
another view), you can assign it to an ``action`` variable inside your server |
200). | ||
- `request.make_json_response(data, headers=None, cookies=None, status=200)` to manually create a | ||
JSON response; the data will be json-serialiazed using `json.dumps` utility; this can be useful | ||
to set up machine-to-machine communications via API calls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
machine-to-machine sounds like the Quebec version of S2S 😄
I added the |
5002216
to
55ef4be
Compare
Introduce a new tutorial about creating Odoo modules using XML data files instead of Python code. This guide is follows closely the 'Server Framework 101' tutorial and covers the following: - Module structure and deployment - Defining models and fields - Setting up security and access rights - Creating views and actions - Implementing relational fields (many2one, many2many, one2many) - Working with computed and related fields - Adding business logic through server actions and automation rules - Creating website controllers for API endpoints The tutorial includes practical exercises and code examples to reinforce learning, catering to developers who need to customize Odoo without writing Python code (e.g. Odoo PS-Tech employees, partners that focus on SaaS instances or author of Industry modules). Task-4167176
55ef4be
to
2bf860c
Compare
@robodoo r+ |
Introduce a new tutorial about creating Odoo modules using XML data files instead of Python code. This guide is follows closely the 'Server Framework 101' tutorial and covers the following: - Module structure and deployment - Defining models and fields - Setting up security and access rights - Creating views and actions - Implementing relational fields (many2one, many2many, one2many) - Working with computed and related fields - Adding business logic through server actions and automation rules - Creating website controllers for API endpoints The tutorial includes practical exercises and code examples to reinforce learning, catering to developers who need to customize Odoo without writing Python code (e.g. Odoo PS-Tech employees, partners that focus on SaaS instances or author of Industry modules). Task-4167176 closes #11050 Signed-off-by: Bouvy Damien (dbo) <[email protected]>
Introduce a new tutorial about creating Odoo modules using XML data files
instead of Python code.
This guide is follows closely the 'Server Framework 101' tutorial and
covers the following:
The tutorial includes practical exercises and code examples to reinforce
learning, catering to developers who need to customize Odoo without writing
Python code (e.g. Odoo PS-Tech employees, partners that focus on SaaS instances
or author of Industry modules).
Task-4167176