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

[16.0][MIG] sale_order_invoicing_grouping_criteria #1300

Conversation

JavierIniesta
Copy link

No description provided.

@JavierIniesta JavierIniesta changed the title 16.0 mig sale order invoicing grouping criteria [16.0][MIG] sale_order_invoicing_grouping_criteria Dec 9, 2022
@rafaelbn
Copy link
Member

rafaelbn commented Dec 9, 2022

/ocabot migration sale_order_invoicing_grouping_criteria

@OCA-git-bot OCA-git-bot added this to the 16.0 milestone Dec 9, 2022
@OCA-git-bot OCA-git-bot mentioned this pull request Dec 9, 2022
60 tasks
@JavierIniesta JavierIniesta marked this pull request as ready for review December 21, 2022 06:55
@JavierIniesta
Copy link
Author

We have done functional tests and it works correctly.

@rp-landoo
Copy link

Hi @JavierIniesta
Runboat is not working, could you push the commits again so it'll work?
Thanks!

@JavierIniesta JavierIniesta force-pushed the 16.0-mig-sale_order_invoicing_grouping_criteria branch from c4eecb3 to ba59adb Compare May 3, 2023 06:42
@JavierIniesta
Copy link
Author

Hi @rp-landoo

I rebased 16.0. Runbot is now working.

Copy link

@rp-landoo rp-landoo left a comment

Choose a reason for hiding this comment

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

Functional approval

Copy link

@Gelo-fl Gelo-fl left a comment

Choose a reason for hiding this comment

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

Functional revision OK

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

pedrobaeza and others added 12 commits June 2, 2023 07:52
…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
@JavierIniesta JavierIniesta force-pushed the 16.0-mig-sale_order_invoicing_grouping_criteria branch from ba59adb to 67d629c Compare June 2, 2023 05:53
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@RodrigoBM
Copy link

is it possible to merge this PR? @OCA/accounting-maintainers

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-1300-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 57be104 into OCA:16.0 Jun 2, 2023
7 checks passed
@OCA-git-bot
Copy link
Contributor

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

odooNextev pushed a commit to odooNextev/account-invoicing that referenced this pull request Sep 29, 2023
Signed-off-by AaronHForgeFlow
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.

None yet