Skip to content

Conversation

@Andrii9090-tecnativa
Copy link

@Andrii9090-tecnativa Andrii9090-tecnativa commented Oct 16, 2025

The date.range model currently supports only a single company (company_id).
This requires creating multiple date ranges for different companies, which complicates management.
To resolve this, we replace the field company_id with company_ids (Many2many) in the model date.range

It's a short video with funcional test
https://www.loom.com/share/f1a0719eafa443058e3a0befc0eed9b4?sid=fbbd55c0-f75d-48aa-b9ec-d93e28af320f

Issue
@moduon
MT-10678

@OCA-git-bot
Copy link
Contributor

Hi @lmignon,
some modules you are maintaining are being modified, check this out!

@Andrii9090-tecnativa Andrii9090-tecnativa marked this pull request as draft October 16, 2025 13:50
@Andrii9090-tecnativa Andrii9090-tecnativa changed the title [IMP] date_range: Set multicompanies support for the date.range model [18.0][IMP] date_range: Set multicompanies support for the date.range model Oct 16, 2025
@Andrii9090-tecnativa Andrii9090-tecnativa marked this pull request as ready for review October 16, 2025 14:10
Copy link

@cav-adhoc cav-adhoc left a comment

Choose a reason for hiding this comment

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

LGTM

@Andrii9090-tecnativa
Copy link
Author

Hi @lmignon can you review this PR?

Thanks ❤️

@rafaelbn
Copy link
Member

Hello @StefanRijnhart , @sbidoul @lmignon ✋🏼

Please could you please take a look here just a quick review? 🙏🏼 😄

Thank you!!!! ❤️
Rafael

@EmilioPascual
Copy link

@Andrii9090 can you rebase it for review it functionally? Thank you.

@Andrii9090-tecnativa Andrii9090-tecnativa force-pushed the 18.0-imp-date_range-multi_companies branch from 9145b7e to 11d2e14 Compare January 7, 2026 11:54
@Andrii9090-tecnativa
Copy link
Author

@EmilioPascual runboat is available, you can functionally review it.

Copy link

@EmilioPascual EmilioPascual left a comment

Choose a reason for hiding this comment

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

LGTM. Functional and code review.

Good work @Andrii9090

@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). 🤖

@Andrii9090-tecnativa
Copy link
Author

Hello @StefanRijnhart , @sbidoul @lmignon

Please could you take a look this PR just a quick review?

Copy link

@Gelojr Gelojr left a comment

Choose a reason for hiding this comment

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

Congratulations on the great work on this PR @Andrii9090 .
The following functional tests have been performed with the results indicated below.

  • Test 1: Creation of a minimal Date Range Type – OK
  • Test 2: Multi-company Date Range creation using company_ids – OK
  • Test 3: Creation of a global Date Range without companies – OK
  • Test 4: Overlap blocking when Date Ranges share at least one company and overlap is not allowed – OK
  • Test 5: Overlap allowed when Date Ranges do not share any company – OK
  • Test 6: Consistency check between Date Range Type company_id and Date Range company_ids – OK
  • Test 7: Generate Date Ranges wizard creates Date Ranges with company_ids correctly set – OK
  • Test 8: Multi-company record rule visibility based on company_ids – OK
  • Test 9: Generate Date Ranges wizard with empty Company field generates global Date Ranges only (no duplication per company) – OK

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

Code review.

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

Some comments to improve code. Mostly OK. Thanks!

The date.range model currently supports only a single company (company_id).
This requires creating multiple date ranges for different companies,
which complicates management.
To resolve this, replace the company_id field with company_ids (Many2many).

MT-10678
@Andrii9090-tecnativa Andrii9090-tecnativa force-pushed the 18.0-imp-date_range-multi_companies branch from f6c266d to f63cdf8 Compare January 9, 2026 15:25
Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

/ocabot merge major

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 18.0-ocabot-merge-pr-1172-by-yajo-bump-major, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 1f1d390 into OCA:18.0 Jan 20, 2026
7 checks passed
@OCA-git-bot
Copy link
Contributor

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

Copy link
Contributor

@carlos-lopez-tecnativa carlos-lopez-tecnativa left a comment

Choose a reason for hiding this comment

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

@christian-ramos-tecnativa

Fixed here OCA/account-financial-reporting#1437

@Andrii9090-tecnativa Andrii9090-tecnativa deleted the 18.0-imp-date_range-multi_companies branch January 21, 2026 07:40
@sbidoul
Copy link
Member

sbidoul commented Jan 21, 2026

This is also breaking mis_builder. Is there no way to achieve the use case while keeping some backward compatibility?

@sbidoul
Copy link
Member

sbidoul commented Jan 21, 2026

@rafaelbn @yajo @Andrii9090 what do you think? Any chance to introduce some backward compatibility. In OCA/mis-builder#758 (comment), @pedrobaeza is suggesting a searchable company_id field.

@yajo
Copy link
Member

yajo commented Jan 21, 2026

Apologies! I didn't realize the impact when I reviewed it.

We can use https://github.com/OCA/multi-company/blob/18.0/base_multi_company/models/multi_company_abstract.py to get the backwards compatibility.

@pedrobaeza
Copy link
Member

We can't add a new dependency in the modules...

@sbidoul
Copy link
Member

sbidoul commented Jan 21, 2026

We can't add a new dependency in the modules...

Why not?

@yajo
Copy link
Member

yajo commented Jan 21, 2026

Yes, we do that all the time...

@yajo
Copy link
Member

yajo commented Jan 21, 2026

See #1227.

yajo added a commit to moduon/server-ux that referenced this pull request Jan 21, 2026
Fixes backward incompatibilities introduced by OCA#1172.

@moduon MT-10678
Andrii9090-tecnativa pushed a commit to moduon/server-ux that referenced this pull request Jan 21, 2026
Fixes backward incompatibilities introduced by OCA#1172.

@moduon MT-10678
Copy link

@andreampiovesana andreampiovesana left a comment

Choose a reason for hiding this comment

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

this break all report that use date_range and company_id instead company_ids
you break many apps!
for italy:

  • l10n_it_financial_statements_report

Copy link
Contributor

@juancarlosonate-tecnativa juancarlosonate-tecnativa left a comment

Choose a reason for hiding this comment

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

This change is severely impacting modules. Because of this, I strongly believe the change should be reverted and properly analyzed in more depth.

yajo added a commit to moduon/server-ux that referenced this pull request Jan 22, 2026
Fixes backward incompatibilities introduced by OCA#1172.

@moduon MT-10678
yajo added a commit to moduon/server-ux that referenced this pull request Jan 22, 2026
Fixes backward incompatibilities introduced by OCA#1172.

@moduon MT-10678
@alexis-via
Copy link
Contributor

@Andrii9090 If you want to share date.range across companies, set company_id to False (it is not a required field, cf https://github.com/OCA/server-ux/blob/17.0/date_range/models/date_range.py#L30 , and it is on purpose !) and you will be able to use the date.range from all the companies. I often do that in my multi-company deployments and it works well.

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.