Skip to content

[18.0][IMP] purchase_manual_currency / purchase_stock_manual_currency: refactor to use standard currency_rate#2984

Open
Saran440 wants to merge 2 commits intoOCA:18.0from
ecosoft-odoo:18.0-imp-purchase_manual_currency-use_standard_currency
Open

[18.0][IMP] purchase_manual_currency / purchase_stock_manual_currency: refactor to use standard currency_rate#2984
Saran440 wants to merge 2 commits intoOCA:18.0from
ecosoft-odoo:18.0-imp-purchase_manual_currency-use_standard_currency

Conversation

@Saran440
Copy link
Member

@Saran440 Saran440 commented Mar 6, 2026

Refactor code manual_currency

  • delete is_manual, currency_diff because they are not used
  • delete total_company_currency since the standard field amount_total_cc already exists
  • Replace manual_currency_rate with the standard currency_rate
  • Update test script
  • Reuse standard logic instead of introducing new custom logic

This PR is an improvement based on #2839

cc @TheerayutEncoder @AndreuOForgeFlow @HviorForgeFlow What do you think about this refactor?

@Saran440 Saran440 force-pushed the 18.0-imp-purchase_manual_currency-use_standard_currency branch from 8e4c614 to d1f9533 Compare March 6, 2026 08:25
@Saran440 Saran440 changed the title [18.0][IMP] purchase_manual_currency: refactor to use standard currency_rate [18.0][IMP] purchase_manual_currency / purchase_stock_manual_currency: refactor to use standard currency_rate Mar 6, 2026
@Saran440 Saran440 force-pushed the 18.0-imp-purchase_manual_currency-use_standard_currency branch from d1f9533 to 4a9a88b Compare March 6, 2026 08:27
@TheerayutEncoder
Copy link
Member

Does it mean we cannot edit currency rate on PO, so what the purpose of this module?

@Saran440
Copy link
Member Author

@TheerayutEncoder The currency_rate field already exists in the standard Purchase Order but is hidden.

This module simply exposes that field and allows users to edit it when using manual currency.
The computation still relies on the standard currency_rate logic instead of introducing a custom rate field.

@TheerayutEncoder
Copy link
Member

@TheerayutEncoder The currency_rate field already exists in the standard Purchase Order but is hidden.

This module simply exposes that field and allows users to edit it when using manual currency. The computation still relies on the standard currency_rate logic instead of introducing a custom rate field.

Oh, I see it, so I think the way you did it is good. 👍

Copy link
Member

@HviorForgeFlow HviorForgeFlow left a comment

Choose a reason for hiding this comment

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

I think you've done a great job simplifying those legacy custom fields, would it be required a migration script to don't break existing instances using this module, at least historical data?

@Saran440 Saran440 force-pushed the 18.0-imp-purchase_manual_currency-use_standard_currency branch from 4a9a88b to 637a18a Compare March 16, 2026 09:16
@Saran440
Copy link
Member Author

Saran440 commented Mar 16, 2026

@HviorForgeFlow Thank you for your advice. I added migration script and change version to 18.0.2.0.0 (purchase_manual_currency) and 18.0.1.0.1 (purchase_stock_manual_currency)
Can you check please?

@Saran440 Saran440 force-pushed the 18.0-imp-purchase_manual_currency-use_standard_currency branch from 637a18a to 2f46101 Compare March 17, 2026 02:19
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.

3 participants