-
-
Notifications
You must be signed in to change notification settings - Fork 692
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
[17.0][MIG] account_invoice_refund_link: Migration to 17.0 #1670
[17.0][MIG] account_invoice_refund_link: Migration to 17.0 #1670
Conversation
Enhancements: * Reverse link from invoice to refunds also available. * Link at invoice line level, not only at invoice level. * When installing the module after some refunds have been made, the module tries to find the link to the original invoice for them. * OCA Guidelines compliance. * Compatibility in OpenUpgrade for migrating from 8.0 module account_refund_original. * Tests with 100% coverage. Technical changes: * Rename field origin_invoices_ids to origin_invoice_ids * Rename field refund_invoices_description to refund_reason * Rename addon to account_invoice_refund_link
Odoo already includes a method for preparing the refund, so using it we don't have to make any guess about the returned domain and the method also serves for refunds created directly by code. Initial line match has also been improved comparing product or description.
* [FIX] account_invoice_refund_link: Don't copy m2m fields Many2many fields have copy=True property by default, having an incorrect duplication of origin or refund invoices. Steps to reproduce: * Create an invoice * Refund it * Duplicate the original invoice * The refund will be link to 2 original invoices Included tests covering the use cases for avoiding future regressions.
Since v11, Odoo counts with a field called `refund_invoice_ids` of type one2many, which conflicts with the m2m field defined in this module. Moreover, these fields are not needed anymore. There is only 2 OCA modules using this module right now, and they don't need significant changes for this adaptation, but I will do it when this get merged.
Currently translated at 100.0% (17 of 17 strings) Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_refund_link/de/
Currently translated at 100.0% (17 of 17 strings) Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_refund_link/pt_BR/
Currently translated at 100.0% (11 of 11 strings) Translation: account-invoicing-13.0/account-invoicing-13.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-13-0/account-invoicing-13-0-account_invoice_refund_link/pt_BR/
…edit note invoice has done from sale order.
Currently translated at 100.0% (12 of 12 strings) Translation: account-invoicing-13.0/account-invoicing-13.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-13-0/account-invoicing-13-0-account_invoice_refund_link/pt_BR/
/ocabot migration account_invoice_refund_link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional review LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look in to the migration guid:
https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-17.0
- The commit history is not cleaned up.
- The required commits missing and your changes are mixed up into one commit
- [IMP] $module: pre-commit auto fixes
- [MIG] $module: Migration to 17.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The readme files need to be kept as md files!
5fdd8c5
to
9642655
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better but not yet 100%.
According to the migration guide, the last commits should look like this:
Here you can find the instruction how and which commits to squash: https://github.com/OCA/maintainer-tools/wiki/Merge-commits-in-pull-requests#mergesquash-the-commits-generated-by-bots-or-weblate
Currently translated at 91.6% (11 of 12 strings) Translation: account-invoicing-15.0/account-invoicing-15.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-15-0/account-invoicing-15-0-account_invoice_refund_link/ca/
With the previous algorithm, if something modifies the order of the returned lines, there are chances of linking invoice lines with non refund lines (but other journal items). We assure at least that only refund lines are linked restricting the iteration on them. TT38633
Currently translated at 100.0% (12 of 12 strings) Translation: account-invoicing-16.0/account-invoicing-16.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_refund_link/hr/
Currently translated at 100.0% (12 of 12 strings) Translation: account-invoicing-16.0/account-invoicing-16.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_refund_link/pt/
On the side by side comparison, exclude the lines that are not products, as that's what we do on the refund lines.
Hooking on a high level method like `_reverse_moves` (although still being private), makes that other modules hooking into it may alter the number of returned lines (like for example, account_invoice_refund_line_selection). We choose the low-level `copy_data` method that is used in such method for linking the refund lines with their origin ones, avoiding the problem.
Currently translated at 100.0% (12 of 12 strings) Translation: account-invoicing-16.0/account-invoicing-16.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_refund_link/es/
- Include context keys for avoiding mail operations overhead.
Currently translated at 100.0% (12 of 12 strings) Translation: account-invoicing-16.0/account-invoicing-16.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_refund_link/pt_BR/
Currently translated at 100.0% (12 of 12 strings) Translation: account-invoicing-16.0/account-invoicing-16.0-account_invoice_refund_link Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_refund_link/it/
f2c12d9
to
676f4d8
Compare
@pedrobaeza can you merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ocabot merge nobump
This PR has the |
On my way to merge this fine PR! |
Congratulations, your PR was merged at 216644c. Thanks a lot for contributing to OCA. ❤️ |
No description provided.