Skip to content

[18.0][ADD] contract_line_defer: Avoid invoicing line until activated - #1342

Open
tobiaszehntner wants to merge 3 commits into
OCA:18.0from
acsone:18.0-add-contract-line-defer
Open

tobiaszehntner wants to merge 3 commits into
OCA:18.0from
acsone:18.0-add-contract-line-defer

Conversation

@tobiaszehntner

Copy link
Copy Markdown
Contributor

Defer Contract Lines to avoid invoicing while start date unknown

Enable to defer contract line's invoicing. If a contract line start date is not known, it can be deferred. It will not be invoiced until manually activated.

@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch from 6f7b2ba to c710c94 Compare November 18, 2025 13:20

@acsonefho acsonefho left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Only minor stuff!
Really good job 💪

Comment thread contract_line_defer_successor/__manifest__.py
Comment thread contract_line_defer/wizards/contract_line_activate_wizard.py Outdated
Comment thread product_contract_line_defer/__manifest__.py
Comment thread product_contract_line_defer/models/sale_order_line.py Outdated
Comment thread product_contract_line_defer/models/sale_order_line_contract_mixin.py Outdated
@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch 2 times, most recently from 0541b4c to 00ca05a Compare November 20, 2025 08:46
@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch from 00ca05a to 30a185f Compare January 16, 2026 13:09
@bosd

bosd commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

@tobiaszehntner Can you please fix the tests?

@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch 3 times, most recently from 50740b8 to 858be8a Compare February 5, 2026 16:29
@tobiaszehntner

Copy link
Copy Markdown
Contributor Author

@tobiaszehntner Can you please fix the tests?

rebased branch which fixed the tests. Added extra tests for improving coverage.

@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch from 858be8a to 571be12 Compare June 5, 2026 11:19
@OCA-git-bot OCA-git-bot added series:18.0 mod:product_contract_line_defer Module product_contract_line_defer mod:contract_line_defer_successor Module contract_line_defer_successor mod:contract_line_defer Module contract_line_defer labels Jun 5, 2026
@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch from 571be12 to fdfafde Compare June 5, 2026 14:59
@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch 3 times, most recently from bc976fb to 3c91e70 Compare June 8, 2026 08:27
Comment thread contract_line_defer/models/contract_line.py Outdated
@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch from 3c91e70 to f8eea3b Compare June 8, 2026 14:08

@bosd bosd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@bosd

bosd commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@gurneyalex Can you please merge?

@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch 3 times, most recently from afca6d2 to c31cdf5 Compare September 21, 2026 09:07
@sbejaoui sbejaoui changed the title 18.0 add contract line defer [18.0][ADD] contract_line_defer: Avoid invoicing line until activated Sep 21, 2026

@qgroulard qgroulard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM (code review)

@OCA-git-bot

Copy link
Copy Markdown
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). 🤖

@victor-champonnois victor-champonnois left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Functional test OK. Thank you for the great readme.

Just two non-blocking comments :

  • I note that the module contract_service_dates is not affected by the defered field. It could be nice to have a glue module at some point.
  • Also, the field "Next Period Start" is still filled and visible even the line is deferred. This could generate confusion.

@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch from 56da702 to e2b18dd Compare September 21, 2026 14:46
@tobiaszehntner

Copy link
Copy Markdown
Contributor Author
  • I note that the module contract_service_dates is not affected by the defered field. It could be nice to have a glue module at some point.
  • Also, the field "Next Period Start" is still filled and visible even the line is deferred. This could generate confusion.

@victor-champonnois Thanks! I fixed the next period start (now False if deferred) and added a point to the readme/Roadmap regarding contract_service_dates module.

if not self.is_deferred:
today = fields.date.today()
if not self.date_start or self.date_start < today:
self.date_start = today

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@tobiaszehntner Contract line date_start and date_end are computed. Don't use onchanges.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed for date_start and left for date_end as it's not computed on the contract mixin

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@rousseldenis hah that doesn't actually work. The onchange was for the single purpose when the user de-selects is_deferred in the view. but if I move it to the view it triggers on any contract.line that has is_deferred False. I reverted to onchange

2026-09-22 09:36:11,339 337 ERROR odoo odoo.addons.contract_sale_generation.tests.test_contract_sale: FAIL: TestContractSale.test_contract
Traceback (most recent call last):
  File "/__w/contract/contract/contract_sale_generation/tests/test_contract_sale.py", line 25, in test_contract
    self.assertEqual(self.contract_line.recurring_next_date, recurring_next_date)
AssertionError: datetime.date(2026, 10, 22) != datetime.date(2020, 2, 15)
 
2026-09-22 09:36:11,492 337 ERROR odoo odoo.addons.contract_sale_generation.tests.test_contract_sale: FAIL: TestContractSale.test_contract_autoconfirm
Traceback (most recent call last):
  File "/__w/contract/contract/contract_sale_generation/tests/test_contract_sale.py", line 40, in test_contract_autoconfirm
    self.assertEqual(self.contract_line.recurring_next_date, recurring_next_date)
AssertionError: datetime.date(2026, 10, 22) != datetime.date(2020, 2, 15)

@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch from e2b18dd to f641b65 Compare September 22, 2026 09:30
@tobiaszehntner
tobiaszehntner force-pushed the 18.0-add-contract-line-defer branch from f641b65 to 7fe1737 Compare September 22, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved mod:contract_line_defer_successor Module contract_line_defer_successor mod:contract_line_defer Module contract_line_defer mod:product_contract_line_defer Module product_contract_line_defer ready to merge series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants