Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I would like to add a field into the Quotation/Sale Order so I added it into report_saleorder.xml but either it's not correct place or I did something wrong.
Where should I add it to have it on printouts ?
First you need to create the fields you want to add. You can do this in developer mode (http://pulse7.net/openerp/odoo-9-how-to-activate-developer-mode/) or create your own module. (https://www.odoo.com/documentation/8.0/howtos/backend.html#build-an-odoo-module)
Developer Mode: Go to settings->technical->models and search for sale.order. Once you are on the sale model you can edit and add a field. It is good practice to name your field with the prefix "x_" (i.e. "x_mycustomfield") Use other fields as a means to determine what type of data (Field Type) you should choose. (i.e. char, integer, datetime etc).
Now that you have added your field you can now add it to the qweb view of the report. The one you will want to edit is "report_saleorder_document". FYI, the way to find the correct qweb views for any report is as follows:
Go to settings->technical->reports and search for the model (i.e. sale.order.) Open that and look click the link "search associated qweb views".
Once you have opened report_saleorder_document you can edit in your custom field. For example, if you wanted to add your field right after Unit Price you would look for
<th class="text-right">Unit Price</th>
<th class="text-right">My Custom Field</th>
Then look below for
<span t-field="l.price_unit"/> </td>
and add right after
<span t-field="l.x_mycustomfield"/> </td>
If you get an error when saving it may be that your custom field is not registered yet or misspelled.
The better way to do this is with a custom module. It's not too hard to do and there are several good tutorials. You will need to search for how to create custom modules that extend models and how to create custom reports or modify reports.
Also, as the previous answer indicated, you can also easily add your custom field to the tree and form views if desired. As long as you are in developer mode just go to sales->sales orders and on the bottom of the window click view-edit tree view or if you click on an order you can click view -> edit form view. Use the existing fields as an example of how to add your field. It's a little different than the qweb.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 3/4/16, 10:13 AM|
|Seen: 971 times|
|Last updated: 3/7/16, 8:45 AM|