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

[17.0] [MIG] sale_order_invoicing_grouping_criteria: Migration to 17.0 #1752

Conversation

RogerSans
Copy link

@RogerSans RogerSans commented Jul 2, 2024

supersede: #1707
Standard migration
T-6282
@HaraldPanten

pedrobaeza and others added 30 commits July 2, 2024 16:02
…rouping criteria

This module allows to use custom criteria for grouping sales orders to be
invoiced.

Default criteria for grouping (invoicing partner and currency used) will be
always applied, as if not respected, there will be business inconsistencies,
but you can add more fields to split the invoicing according them.

Configuration
=============

For creating new grouping criteria:

1. Go to *Invoicing > Configuration > Management > Invoicing Grouping Criteria*.
2. Create or modify existing criteria, selecting fields belonging to "Sales
   Order" header model for grouping according them.
3. Invoicing address and currency will always be applied with the selected
   ones.

For setting a different grouping criteria for a specific customer:

1. Go to *Invoicing > Sales > Master Data > Customers*.
2. Open the desired customer.
3. Go to *Invoicing* page.
4. Set on "Sales Invoicing Grouping Criteria" the desired grouping
   criteria.

For setting a different default grouping criteria than the standard for the
whole company:

1. Go to *Invoicing > Configuration> Settings*.
2. Locate inside "Sales Order Invoicing" section, the field "Default
   Grouping Criteria".
3. Introduce there the grouping criteria to be applied by default. If empty,
   the general default of invoicing address + currency will be applied.

Usage
=====

1. Go to *Sales > Invoicing > Orders to Invoice*.
2. Select sales orders whose invoicing you want to do.
3. Click on *Action > Invoice Order*.
4. Click on "Create and View Invoices" button.
5. On that moment, the grouping criteria will be applied, and you will see
   different invoices if the criteria doesn't match for them.
Odoo now includes a hook for obtaining the grouping criteria, so we are making use
of it for cleaning some code and being compatible with other developments.

We also clarifies in documentation the new company grouping criteria also introduced
by Odoo, as v13 allows to see several companies at the same time.
…riteria, but slice super calls

It turns out that the grouping criteria is applied over the invoice vals dictionary
list instead on sales order so you can't group by any field in sales order,
including the trick of slicing by ID for not grouping at all.

We then restore and adapt the v12 code, that slices the recordset in pieces
according the grouping criteria with fields obtained in the sales orders.
- The partner to get the grouping criteria should be the invoice address (if set) as this one will be used to create the invoice;
- Extract this part into a function to have a overwritable point;
- Little improvement into unit test: disable tracking.
The function signature has changed in 14.0
Currently translated at 100.0% (21 of 21 strings)

Translation: account-invoicing-15.0/account-invoicing-15.0-sale_order_invoicing_grouping_criteria
Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-15-0/account-invoicing-15-0-sale_order_invoicing_grouping_criteria/fr/
Currently translated at 100.0% (21 of 21 strings)

Translation: account-invoicing-15.0/account-invoicing-15.0-sale_order_invoicing_grouping_criteria
Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-15-0/account-invoicing-15-0-sale_order_invoicing_grouping_criteria/ca/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-invoicing-16.0/account-invoicing-16.0-sale_order_invoicing_grouping_criteria
Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-sale_order_invoicing_grouping_criteria/
Currently translated at 100.0% (21 of 21 strings)

Translation: account-invoicing-16.0/account-invoicing-16.0-sale_order_invoicing_grouping_criteria
Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-sale_order_invoicing_grouping_criteria/ca/
Currently translated at 100.0% (21 of 21 strings)

Translation: account-invoicing-16.0/account-invoicing-16.0-sale_order_invoicing_grouping_criteria
Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-sale_order_invoicing_grouping_criteria/de/
Currently translated at 66.6% (14 of 21 strings)

Translation: account-invoicing-16.0/account-invoicing-16.0-sale_order_invoicing_grouping_criteria
Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-sale_order_invoicing_grouping_criteria/it/
Currently translated at 100.0% (21 of 21 strings)

Translation: account-invoicing-16.0/account-invoicing-16.0-sale_order_invoicing_grouping_criteria
Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-sale_order_invoicing_grouping_criteria/it/
@RogerSans RogerSans changed the title [17.0] [MIG] saleorder invoicing grouping criteria [17.0] [MIG] sale_order_invoicing_grouping_criteria: Migration to 17.0 Jul 2, 2024
@HaraldPanten
Copy link

/ocabot migration sale_order_invoicing_grouping_criteria

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Jul 2, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Jul 2, 2024
46 tasks
@RogerSans RogerSans force-pushed the 17.0-mig-sale_order_invoicing_grouping_criteria branch from 8285c0d to 7fefdae Compare July 12, 2024 08:55
Copy link

@luis-ron luis-ron left a comment

Choose a reason for hiding this comment

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

Functional Review: LGTM 👍🏻

Copy link

@Tisho99 Tisho99 left a comment

Choose a reason for hiding this comment

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

Please, review the README, i think that the strings of the menus and the buttons have changed in v17

Here are 2 examples

image

Usage
=====

1. Go to *Sales > Invoicing > Orders to Invoice*.
Copy link

Choose a reason for hiding this comment

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

Suggested change
1. Go to *Sales > Invoicing > Orders to Invoice*.
1. Go to *Sales > To Invoice > Orders to Invoice*.

Copy link
Author

Choose a reason for hiding this comment

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

Changed


1. Go to *Sales > Invoicing > Orders to Invoice*.
2. Select sales orders whose invoicing you want to do.
3. Click on *Action > Invoice Order*.
Copy link

Choose a reason for hiding this comment

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

Suggested change
3. Click on *Action > Invoice Order*.
3. Click on *Action > Create Invoices*.

Copy link
Author

Choose a reason for hiding this comment

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

Changed

@@ -113,3 +114,8 @@ def test_commercial_field(self):
self.assertEqual(
children.sale_invoicing_grouping_criteria_id, self.grouping_criteria
)

@classmethod
Copy link

Choose a reason for hiding this comment

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

Are you sure this changes are needed? I think that if the requests library was nos used before we don't have to add this code

Copy link

Choose a reason for hiding this comment

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

I refer to all changes done in tests

Copy link
Author

Choose a reason for hiding this comment

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

removed

@RogerSans RogerSans force-pushed the 17.0-mig-sale_order_invoicing_grouping_criteria branch 3 times, most recently from bfecd22 to 51adc71 Compare July 15, 2024 08:49
@@ -1,12 +1,13 @@
# Copyright 2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests import TransactionCase
from odoo.tests import TransactionCase, requests
Copy link

Choose a reason for hiding this comment

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

You also need to remove this

Copy link
Author

Choose a reason for hiding this comment

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

Done



class TestSaleOrderInvoicingGroupingCriteria(TransactionCase):
@classmethod
def setUpClass(cls):
cls._super_send = requests.Session.send
Copy link

Choose a reason for hiding this comment

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

You also need to remove this

Copy link
Author

Choose a reason for hiding this comment

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

Done

@RogerSans RogerSans force-pushed the 17.0-mig-sale_order_invoicing_grouping_criteria branch 2 times, most recently from 7700732 to dc4c57f Compare July 15, 2024 09:25
Copy link

@Tisho99 Tisho99 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@HaraldPanten HaraldPanten left a comment

Choose a reason for hiding this comment

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

@RogerSans you forgot to add Sygel contributors. Didn't you?

@RogerSans RogerSans force-pushed the 17.0-mig-sale_order_invoicing_grouping_criteria branch from 0627530 to 0e440ac Compare July 15, 2024 14:44
@RogerSans
Copy link
Author

@RogerSans you forgot to add Sygel contributors. Didn't you?

Yes, my mistake. Added.

@RogerSans RogerSans force-pushed the 17.0-mig-sale_order_invoicing_grouping_criteria branch from 16fc4c3 to d35a09d Compare July 15, 2024 15:07
@RogerSans RogerSans force-pushed the 17.0-mig-sale_order_invoicing_grouping_criteria branch from 45a6308 to 4351547 Compare July 16, 2024 08:21
@HaraldPanten
Copy link

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 17.0-ocabot-merge-pr-1752-by-HaraldPanten-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 7986a0b into OCA:17.0 Jul 16, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 01cc8a2. Thanks a lot for contributing to OCA. ❤️

@HaraldPanten HaraldPanten deleted the 17.0-mig-sale_order_invoicing_grouping_criteria branch July 16, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.