Skip to content

Conversation

@qgroulard
Copy link
Contributor

In the journal ledger report, only move lines with tax_line_id had their taxes displayed.
The case where taxes come from move_line_ids_taxes_data seems to have been forgotten.

We solve two problems.
First, move_line_ids_taxes_data was never propagated, thus always empty.
Second, tax name and description get from sql queries are json values. We now handle translations.

We solve two problems.
First, move_line_ids_taxes_data was never propagated, thus always empty.
Second, tax name and description get from sql queries are json values. We now handle translations.
@qgroulard qgroulard changed the title [FIX] account_financial_report: journal ledger move_line_ids_taxes_data [18.0][FIX] account_financial_report: journal ledger move_line_ids_taxes_data Dec 10, 2025
@flotho
Copy link
Member

flotho commented Dec 18, 2025

ping @DorianMAG

Copy link
Member

@flotho flotho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

Thanks for this usefull PR.
Code could be optimized.
You defined L206 the lang variable. Its value is either en_US or another one, never None AFAICS.
Though, you don't need anymore to switch case on lang in L221 and L223
Could you change this ?

Regards

@qgroulard
Copy link
Contributor Author

Hi,

Thanks for this usefull PR. Code could be optimized. You defined L206 the lang variable. Its value is either en_US or another one, never None AFAICS. Though, you don't need anymore to switch case on lang in L221 and L223 Could you change this ?

Regards

Hi, thanks for your review.

The thing is you don't necessarily have a translation for your current language.
If you look in DB, even though a language is installed, translatable fields will have no other key than "en_US" until they are actually translated once.

move_line_ids_taxes_data[move_line_id][account_tax_id] = {
"name": tax_name,
"description": tax_description,
"name": tax_name.get(lang) or tax_name.get("en_US"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
Thanks for this usefull PR. Code could be optimized. You defined L206 the lang variable. Its value is either en_US or another one, never None AFAICS. Though, you don't need anymore to switch case on lang in L221 and L223 Could you change this ?
Regards

Hi, thanks for your review.

The thing is you don't necessarily have a translation for your current language. If you look in DB, even though a language is installed, translatable fields will have no other key than "en_US" until they are actually translated once.

Thanks for the answer.
I thought I've understood what you want to do.
What I'm proposing is to change this :
"name": tax_name.get(lang) or tax_name.get("en_US"),
By
"name": tax_name.get(lang),
You can do this because you defined a lang variable with a default value that will be en_US. So the test you made is redundant regarding the possible values in the lang variable.
Am I missing something?
regards

Copy link
Contributor Author

@qgroulard qgroulard Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's say I have French and English installed on my DB and my current language is French.

  • lang = "fr_FR"
  • tax_name might be: {"en_US": "Tax 21%"}

Hence, tax_name.get(lang) will return False, which will eventually end up as an empty column in the report.

What I have implemented is a fallback on English translation. This is similar to what the ORM does, if you open the form view of the tax the name won't be empty if you have no French translation, the English name will be displayed instead.

Copy link
Member

@flotho flotho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your clear answer.

I missed this one that data in the json could be "de"synchronized from installed languages.

So evrything is OK
LGTM

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

Successfully merging this pull request may close these issues.

2 participants