Skip to content

[19.0][MIG] product_contract - #1371

Open
bosd wants to merge 108 commits into
OCA:19.0from
bosd:19.0-mig-product_contract
Open

bosd wants to merge 108 commits into
OCA:19.0from
bosd:19.0-mig-product_contract

Conversation

@bosd

@bosd bosd commented Dec 29, 2025 •

Copy link
Copy Markdown
Contributor

Standard migration using odoo-module-migrator .

This version is severly cleaned according to:
https://github.com/OCA/maintainer-tools/wiki/Merge-commits-in-pull-requests#mergesquash-the-commits-generated-by-bots-or-weblate

Total reduction from 202 to 105 commits (44% reduction)

Also lists the depends properly.

depends on:
#1312
#1367
#1370

@bosd
bosd force-pushed the 19.0-mig-product_contract branch 2 times, most recently from 663c231 to be0367d Compare December 30, 2025 09:12
@bosd

bosd commented Dec 30, 2025

Copy link
Copy Markdown
Contributor Author

/ocabot migration product_contract

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Sorry @bosd you are not allowed to mark the addon to be migrated.

To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons.

If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the maintainers key of its manifest.

@bosd
bosd force-pushed the 19.0-mig-product_contract branch 4 times, most recently from 53f361e to 3600f5d Compare December 30, 2025 13:52
@bosd
bosd marked this pull request as ready for review December 30, 2025 13:53
@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot migration product_contract

@bosd I see that you have generated Merged bot/translation changes commits, while the idea is to squash that ones into the real commit that generates them (i. e. [IMP], [FIX] or [MIG] commits).

@OCA-git-bot OCA-git-bot added this to the 19.0 milestone Dec 30, 2025
@OCA-git-bot OCA-git-bot mentioned this pull request Dec 30, 2025
28 tasks
@bosd

bosd commented Dec 30, 2025

Copy link
Copy Markdown
Contributor Author

/ocabot migration product_contract

@bosd I see that you have generated Merged bot/translation changes commits, while the idea is to squash that ones into the real commit that generates them (i. e. [IMP], [FIX] or [MIG] commits).

Yeah, I noticed that the custom script i used, created this..
(On this module it was a but to much to do manually).
It's not optimal oca style, but decided to open this pr anyway, and see how this "lands".

@pedrobaeza

Copy link
Copy Markdown
Member

Uhm, I don't think it's OK, as now it's even more confusing about its source. I would prefer to let them as it was than this way.

@bosd
bosd force-pushed the 19.0-mig-product_contract branch from 3600f5d to 53cde28 Compare December 30, 2025 19:04
@bosd

bosd commented Dec 30, 2025

Copy link
Copy Markdown
Contributor Author

It is ok now

@bosd
bosd force-pushed the 19.0-mig-product_contract branch from 53cde28 to 321af49 Compare January 2, 2026 13:59
@bosd
bosd force-pushed the 19.0-mig-product_contract branch from 670735b to bcf1c24 Compare February 10, 2026 11:10
@raulovallet

Copy link
Copy Markdown

Hey @bosd, I found this issue raulovallet@67bfd99. It causes the default values not to be set correctly and throws an error when closing the window. I’m not sure how I can contribute—could you make a cherry-pick or I have to do a pull request here?

@wpichler

Copy link
Copy Markdown
Contributor

Hi @bosd , I am facing an issue here with this module - the required="is_contract" on date_start seems to be wrong. In state draft,sent there must not be a date_start specified. Why is this required ?

@wpichler

Copy link
Copy Markdown
Contributor

Hi @bosd , Please ignore my last comment - i found the real issue...

I have been working on an migrated database (migrated from v16) - i had sale.order.line's with contract_start_date_method='manual' and date_start=null

For the record - i've fixed it with:

 UPDATE sale_order_line sol                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
  SET date_start = COALESCE(                                                                                                                                                                                                                                                                                                                                                                                                                                                               
      (SELECT cl.date_start FROM contract_line cl                                                                                                                                                                                                                                                                                                                                                                                                                                            
        WHERE cl.sale_order_line_id = sol.id AND cl.date_start IS NOT NULL LIMIT 1),
      (SELECT so.date_order::date FROM sale_order so WHERE so.id = sol.order_id),                                                                                                                                                                                                                                                                                                                                                                                                            
      sol.create_date::date                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  FROM product_product pp                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
  JOIN product_template pt ON pt.id = pp.product_tmpl_id                                                                                                                                                                                                                                                                                                                                                                                                                                   
  WHERE sol.product_id = pp.id                                                                                                                                                                                                                                                                                                                                                                                                                                                               
    AND pt.is_contract IS TRUE
    AND sol.date_start IS NULL                                                                                                                                                                                                                                                                                                                                                                                                                                                               
    AND COALESCE(sol.contract_start_date_method, 'manual') = 'manual';

@bosd
bosd force-pushed the 19.0-mig-product_contract branch from e1d146d to a31eb84 Compare May 12, 2026 21:16
@bosd
bosd force-pushed the 19.0-mig-product_contract branch from a31eb84 to a375146 Compare June 11, 2026 06:48
@raulovallet

Copy link
Copy Markdown

Any update for this?

@etobella

etobella commented Sep 4, 2026

Copy link
Copy Markdown
Member

/ocabot rebase

@OCA-git-bot

Copy link
Copy Markdown
Contributor

@etobella The rebase process failed, because command git rebase origin/19.0 failed with output:

Rebasing (1/106)
Rebasing (2/106)
Rebasing (3/106)
Rebasing (4/106)
Rebasing (5/106)
Rebasing (6/106)
Rebasing (7/106)
Rebasing (8/106)
Rebasing (9/106)
Rebasing (10/106)
Rebasing (11/106)
Rebasing (12/106)
Rebasing (13/106)
Rebasing (14/106)
Rebasing (15/106)
Rebasing (16/106)
Rebasing (17/106)
Rebasing (18/106)
Rebasing (19/106)
Rebasing (20/106)
Rebasing (21/106)
Rebasing (22/106)
Rebasing (23/106)
Rebasing (24/106)
Rebasing (25/106)
Rebasing (26/106)
Rebasing (27/106)
Rebasing (28/106)
Rebasing (29/106)
Rebasing (30/106)
Rebasing (31/106)
Rebasing (32/106)
Rebasing (33/106)
Rebasing (34/106)
Rebasing (35/106)
Rebasing (36/106)
Rebasing (37/106)
Rebasing (38/106)
Rebasing (39/106)
Rebasing (40/106)
Rebasing (41/106)
Rebasing (42/106)
Rebasing (43/106)
Rebasing (44/106)
Rebasing (45/106)
Rebasing (46/106)
Rebasing (47/106)
Rebasing (48/106)
Rebasing (49/106)
Rebasing (50/106)
Rebasing (51/106)
Rebasing (52/106)
Rebasing (53/106)
Rebasing (54/106)
Rebasing (55/106)
Rebasing (56/106)
Rebasing (57/106)
Rebasing (58/106)
Rebasing (59/106)
Rebasing (60/106)
Rebasing (61/106)
Rebasing (62/106)
Rebasing (63/106)
Rebasing (64/106)
Rebasing (65/106)
Rebasing (66/106)
Rebasing (67/106)
Rebasing (68/106)
Rebasing (69/106)
Rebasing (70/106)
Rebasing (71/106)
Rebasing (72/106)
Rebasing (73/106)
Rebasing (74/106)
Rebasing (75/106)
Rebasing (76/106)
Rebasing (77/106)
Rebasing (78/106)
Rebasing (79/106)
Rebasing (80/106)
Rebasing (81/106)
Rebasing (82/106)
Rebasing (83/106)
Rebasing (84/106)
Rebasing (85/106)
Rebasing (86/106)
Rebasing (87/106)
Rebasing (88/106)
Rebasing (89/106)
Rebasing (90/106)
Rebasing (91/106)
Rebasing (92/106)
Rebasing (93/106)
Rebasing (94/106)
Rebasing (95/106)
Rebasing (96/106)
Rebasing (97/106)
Rebasing (98/106)
Rebasing (99/106)
Rebasing (100/106)
Rebasing (101/106)
Rebasing (102/106)
Rebasing (103/106)
Rebasing (104/106)
Auto-merging requirements.txt
CONFLICT (add/add): Merge conflict in requirements.txt
error: could not apply af8af692... [IMP] product_contract: pre-commit execution
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply af8af692... # [IMP] product_contract: pre-commit execution

@etobella
etobella force-pushed the 19.0-mig-product_contract branch from a375146 to fc8a7ad Compare September 4, 2026 09:14
jaenbox and others added 17 commits September 4, 2026 13:22
…ree not editable

Before this changes, when trying to edit a line of sale order, it was
opening the form of the line. But following the way to work of odoo
with sale event, we have make a new contract configurator that will
be opened when selecting a product of type contract.
…using confirmation date_start

With these changes, we allow the contract line start date to be computed
using the order confirmation date. When the product is configured with
any of the options set in contract_start_date_method other than manual,
the start date will be calculated based on the established date and the
selected period.

Additionally, we can force the month in which we will work in case the
frequency is yearly, quarterly, or semesterly.

Is not added support for daily, weekly or monthlylastday in this commit.
…ttings

[IMP] product_contract: add Recurrence Number to compute start and end dates

[FIX] product_contract: add sol name dependes

[IMP] product_contract: add recurrence interval

[IMP] product_contract: add recurring_interval
…d to recurrence_number

for more clarity rename default_qty to recurrence_number
…ack a contract template

Before this commit, confirming a sales order would raise an exception if any line lacked a configured contract template, preventing the creation of the contract.

Now, sales order lines without a contract template are automatically added to a new contract without a template, allowing the process to continue seamlessly.
@bosd
bosd force-pushed the 19.0-mig-product_contract branch 2 times, most recently from ca4fb8e to 3d004a4 Compare September 4, 2026 13:25
Comment thread test-requirements.txt Outdated
@@ -0,0 +1 @@
odoo-addon-contract_termination @ git+https://github.com/OCA/contract@refs/pull/1367/head#subdirectory=contract_termination

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.

This should be removed from the migration commit 😉

@bosd
bosd force-pushed the 19.0-mig-product_contract branch from 3d004a4 to a9dbb5c Compare September 22, 2026 08:25
@bosd
bosd requested a review from etobella September 22, 2026 08:25
@bosd
bosd force-pushed the 19.0-mig-product_contract branch from a9dbb5c to 428b17e Compare September 22, 2026 08:28
@bosd

bosd commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@tobiaszehntner an you please review?

Comment thread product_contract/models/product_template.py
bosd and others added 4 commits September 22, 2026 12:47
`contract.contract.sale_order_count` / `action_view_sales_orders` and
`contract.line._get_auto_renew_rule_type` had no test at all, which is what
dropped the patch coverage below the branch baseline.

Add tests for the sale order count, both branches of the sales order action
(single order opens the form, several open the list), the auto renew rule
type mapping for `monthlylastday`, and the sale order line link that
`_prepare_invoice_line` puts on the invoice line.
`sale.order.line.invoice_line_create()` has not existed in `sale` since
v12; invoicing goes through `_create_invoices` / `_prepare_invoice_line`.
The override has therefore been unreachable for several series - calling it
would raise `AttributeError` on the `super()` call - and it is referenced
nowhere else.

Contract lines are already kept out of the sale invoicing flow by the
`_compute_invoice_status` and `_compute_qty_to_invoice` overrides right
next to it, so nothing takes over from this removal.
@bosd
bosd force-pushed the 19.0-mig-product_contract branch from 428b17e to b11857a Compare September 22, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.