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

Retroport: FIX determine multi-currency price on object line create tpl (#28021) #30535

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

altairis-benjamin
Copy link
Contributor

Related to the PR #30473 but with a clean commit.

@lvessiller-opendsi
Copy link
Contributor

Sorry, but you put "NEW" in the title of this PR and it seems to be a FIX.
I follow the related PR and the Issue.
The fix is only on rounding high quantities or is when you use a different currency between the added product and the supplier order ?

@altairis-benjamin altairis-benjamin changed the title Retroport: NEW determine multi-currency price on object line create tpl (#28021) Retroport: FIX determine multi-currency price on object line create tpl (#28021) Aug 9, 2024
@altairis-benjamin
Copy link
Contributor Author

I changed the title, but I juste copied/pasted the original PR title.

In fact, currently, when you add a product on a supplier order, the price taken into account is the one in your own currency.
The price in its original currency is computed from the price in your currency which is multiplicated by the rate and, because of rounded values, the price in the supplier's currency can be wrong, which can cause problems on orders.

With this fix, the price in its original currency is used to calculate all prices: the price in supplier's currency is the good one, and the one in your currency is also correct.

@eldy eldy requested a review from rycks August 10, 2024 22:13
} else {
jQuery("#price_ht").val(up_locale);
var multicurrency_code = $('option:selected', this).attr('data-multicurrency-code'); // When select is done from HTML select
if (multicurrency_code == undefined) { multicurrency_code = jQuery('#idprodfournprice').attr('data-multicurrency-code'); } // When select is done from HTML input with ajax autocomplete
Copy link
Contributor

Choose a reason for hiding this comment

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

Why to use here "== undefined" and not "typeof multicurrency_code === 'undefined'" like in other parts of this JS script ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only because it's a back port of an existing PR. Maybe this change should also be done in develop?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think.
@eldy What is your advice ?

Copy link
Member

@eldy eldy Sep 18, 2024

Choose a reason for hiding this comment

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

As we are in a v18 submission, and it is a backport, code must be the much as possible similar than original,even if code is not as "clean" as we can.

@eldy eldy added the Pending analysis of PR (maintenance team) PR is in a maintenance branch with several approvers. Waiting approval of all of them. label Aug 14, 2024
Copy link
Contributor

@rycks rycks left a comment

Choose a reason for hiding this comment

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

seems ok for me (note: but i don't have multicurrency setup so i can't make real tests)

@eldy
Copy link
Member

eldy commented Sep 18, 2024

seems ok for me (note: but i don't have multicurrency setup so i can't make real tests)

Some PR are difficult to validate without testing it. So you should have environment in v18 dedicated to validate PR. I recommand to have one environment per version with similar data, so if a trouble occurs in v18, you can compare easily with previous v17 or following V19.
This is for example how i work: I created just one virual host pointing to the directory git will all cloned sources versions and i load on the database of all of them the initdemo sql file provided with each version so data are same.
image

@eldy eldy merged commit dcba334 into Dolibarr:18.0 Sep 18, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending analysis of PR (maintenance team) PR is in a maintenance branch with several approvers. Waiting approval of all of them.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants