Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
3908 Zobrazení

Hello All,

We would like to display the total discount our client is receiving from us. In the invoice summary, only the final price is currently shown. We want it to display the breakdown as follows: Public Price - Discount - Final Price.

I found a Tab in Odoo Studio that I could add in the Sales Order as 'Amount Before Discount' (which is not perfect but could work). However, the issue is that it's only visible to us, not for clients.

How can I change that option?


Thank you for help

Avatar
Zrušit
Nejlepší odpověď

Hi,



First, verify the visibility and access rights of the "Amount Before Discount" field (or any field you intend to use for this purpose). In Odoo Studio, check the field's properties to ensure it's visible to the "Portal" group or the "Public" user. If you can't find access rights settings in Odoo Studio, enable developer mode and check the record rules related to the sale.order or account.move models to see if any rules are restricting access to the field.


Next, add the field to the invoice report. The most likely reason your customers can't see the discount is that the field isn't included in the invoice report template. You'll need to customize the report using Odoo Studio's Report Editor. Find a suitable place on the report to add the field, drag and drop it from the "Fields" list, and add labels and formatting to display the discount information clearly. You might need to create a new computed field in the report to calculate the discount amount.


As an alternative, you can modify the report's QWeb code directly, but this requires technical knowledge of QWeb templating. Enable developer mode, find the invoice report, and edit the template view to include the field and calculate the discount amount.


Finally, consider using existing discount fields if available. Odoo might already have fields that store the discount amount or percentage, such as discount or amount_discount on the invoice lines. Check the available fields in Odoo Studio to see if you can use those instead of creating new ones. Remember to test your changes thoroughly and consider creating a custom report that inherits from the standard one for easier upgrades.


Hope it helps



Avatar
Zrušit
Nejlepší odpověď

If you have working solution can you please share with me on Odoo 19 context ?

Avatar
Zrušit
Nejlepší odpověď

1- Go to Odoo Studio and navigate to the model for invoices (account.move).

2- Create a new field to store the "Amount Before Discount." This can be done by adding a new field of type monetary to the account.move model.

3- Define a computed value for this new field. This computed value should calculate the difference between the public price and the final price for each line on the invoice.

4- Go to the Studio Report Designer and edit the invoice report template to include your new field. You can use expressions to fetch and display the calculated "Amount Before Discount."

5- By default, newly added fields might not be visible to the external users. Go to Odoo Studio, navigate to the field you've created, and check its visibility settings. Ensure that it is marked as visible for external users or the "Portal" user type if applicable.

6- Confirm that the user role associated with your clients has the necessary permissions to view this field.


Avatar
Zrušit
Autor

Thank you for your answer. I have changed the visibility, but we can still only see this in Odoo (including Porta user). However, when I try to print a version of the Sales Order / Invoice, the column disappears.
Is there a solution for that?

1- Go to Odoo Studio or the Odoo backend and identify the report template associated with the Sales Order or Invoice. This is often done in the "Settings" or "Technical Settings" section.

2- Once you've identified the report template, edit it using Odoo Studio or by navigating to "Settings" > "Technical" > "Reports."

3- In the report template editor, add the custom field (Amount Before Discount) to the appropriate section of the report where you want it to be displayed.

4- Clear your browser cache or try accessing the printed version in incognito/private mode.

Define a computed value for this new field. This computed value should calculate the difference between the public price and the final price for each line on the invoice.

can you show the python code with odoo studio 19

Related Posts Odpovědi Zobrazení Aktivita
1
bře 24
1475
1
čvc 23
3223
0
čvc 23
25
1
kvě 23
3847
0
kvě 23
2058