Skip to content
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

8.0 Wrong lang when using aeroo for account_credit_control #73

Open
alexis-via opened this issue Dec 7, 2015 · 3 comments
Open

8.0 Wrong lang when using aeroo for account_credit_control #73

alexis-via opened this issue Dec 7, 2015 · 3 comments

Comments

@alexis-via
Copy link
Contributor

I use Odoo v8.

I want to use the OCA module account_credit_control (https://github.com/OCA/account-financial-tools/tree/8.0/account_credit_control) with my prefered reporting engine (aeroo). This module has a report based on the object credit.control.communication (TransientModel) developped in Qweb. So I replaced this Qweb report by an Aeroo report with the following XML code:

<record id="account_credit_control.credit_control_summary" model="ir.actions.report.xml">
    <field name="name">Credit Control Summary</field>
    <field name="model">credit.control.communication</field>
    <field name="report_name">account_credit_control.report_credit_control_summary</field>
    <field name="report_type">aeroo</field>
    <field name="in_format">oo-odt</field>
    <field name="report_rml">rvip_profile/report/credit_control.odt</field>
    <field name="parser_state">default</field>
    <field name="tml_source">file</field>
    <field name="multi" eval="1"/>
    <field name="out_format" ref="report_aeroo.report_mimetypes_odt_odt"/>
</record>

My ODT file is available here:
http://people.via.ecp.fr/~alexis/credit_control.odt

As you can see in this ODT file, it starts with

for each="o in objects"
setLang(o.partner_id.lang or 'en_US')

In the module account_credit_control, you have a wizard to print the credit control letters which outputs one big PDF file with all the letters for all the customers. Each page contains the letter for one particular customer in the customer's language.

With Qweb, it works well, each page contains the fields "o.current_policy_level.name" and "o.current_policy_level.custom_text" in the language of the customer.

With Aeroo, it doesn't work : all the pages use the language of the current user, without taking into accout the setLang instructions inside the report. I added some getLang instructions inside the report to check that it has the right value and I can see that getLang reports the right value, but all the pages are still in the user's language.

I found one interesting thing in my long debug party: the problem doesn't happen any more in Aeroo if the object "credit.control.communication" is converted from TransientModel to a regular Model. I made this change in the code in account_credit_control/wizard/credit_control_communication.py:

class CreditCommunication(models.Model)

then I restart odoo with "-u account_credit_control", and then I see that each page of the report is in the language of the customer.

I would really like to use account_credit_control with Aeroo. If you have an idea on how to solve this bug, I would appreciate it very much. I have already spent a lot of hours on it and all I found is explained above.

@sraps
Copy link
Contributor

sraps commented Dec 8, 2015

Hi, Alexis!

It's quite interesting bug. Upon porting Aeroo to v8 I had to change part that relates to setting language, due to changes in Odoo architecture. I do not know how it is now, but at the time original reports never were able to print multi language reports. Probably they have changed something ever since, have not checked by myself...

@alexis-via
Copy link
Contributor Author

@sraps Thanks for your answer. Could you tell me in which part of the code of Odoo and/or Aeroo those changes are located ? I would like to help fix this issue if I can.... but I don't know where to start searching in the code.

@sraps
Copy link
Contributor

sraps commented Dec 8, 2015

Would not tell, too long ago. Just developed a workaround, that's all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants