Skip to content

[18.0][MIG] Migration of subscription_oca to 18.0#1245

Closed
tarteo wants to merge 28 commits intoOCA:18.0from
tarteo:18.0-mig-subscription_oca
Closed

[18.0][MIG] Migration of subscription_oca to 18.0#1245
tarteo wants to merge 28 commits intoOCA:18.0from
tarteo:18.0-mig-subscription_oca

Conversation

@tarteo
Copy link
Member

@tarteo tarteo commented May 27, 2025

@tarteo tarteo force-pushed the 18.0-mig-subscription_oca branch 2 times, most recently from 105954a to 996eb61 Compare May 27, 2025 09:48
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

Choose a reason for hiding this comment

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

This should be noupdate="1" in case of a user change some values (ex: interval fields).

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

Choose a reason for hiding this comment

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

noupdate="1". Some values could be edited by a user (prefix, padding etc)


def _compute_subscription_count(self):
for record in self:
record.subscription_count = len(record.subscription_ids)

Choose a reason for hiding this comment

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

IMO the best is to do a read_group as you did into sale_order.py.
With a single query, you have all data that you need.

crm_team_id = fields.Many2one(comodel_name="crm.team", string="Sale team")
to_renew = fields.Boolean(default=False, string="To renew")

def cron_subscription_management(self):

Choose a reason for hiding this comment

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

@api.model

@api.depends("invoice_ids", "sale_order_ids.invoice_ids")
def _compute_account_invoice_ids_count(self):
for record in self:
record.account_invoice_ids_count = len(self.invoice_ids) + len(

Choose a reason for hiding this comment

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

⚠️ record instead of self:
record.account_invoice_ids_count = len(record.invoice_ids) + len(record.sale_order_ids.invoice_ids)

@api.depends("product_ids")
def _compute_product_ids_count(self):
for record in self:
record.product_ids_count = len(self.product_ids)

Choose a reason for hiding this comment

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

⚠️ record instead of self:
record.product_ids_count = len(record.product_ids)

@tarteo tarteo force-pushed the 18.0-mig-subscription_oca branch from 996eb61 to baad433 Compare September 17, 2025 11:14
@tarteo
Copy link
Member Author

tarteo commented Sep 17, 2025

@acsonefho Thanks!! I've applied your suggestions

@tarteo tarteo force-pushed the 18.0-mig-subscription_oca branch from baad433 to 150c702 Compare September 17, 2025 11:39
carlos-domatix and others added 23 commits September 17, 2025 13:52
Currently translated at 95.7% (159 of 166 strings)

Translation: contract-16.0/contract-16.0-subscription_oca
Translate-URL: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-subscription_oca/nl/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: contract-17.0/contract-17.0-subscription_oca
Translate-URL: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-subscription_oca/
Currently translated at 100.0% (163 of 163 strings)

Translation: contract-17.0/contract-17.0-subscription_oca
Translate-URL: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-subscription_oca/it/
Currently translated at 92.6% (151 of 163 strings)

Translation: contract-17.0/contract-17.0-subscription_oca
Translate-URL: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-subscription_oca/fi/

Added translation using Weblate (Finnish)
Currently translated at 61.3% (100 of 163 strings)

Translation: contract-17.0/contract-17.0-subscription_oca
Translate-URL: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-subscription_oca/tr/

Translated using Weblate (Turkish)

Currently translated at 58.8% (96 of 163 strings)

Translation: contract-17.0/contract-17.0-subscription_oca
Translate-URL: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-subscription_oca/tr/

Added translation using Weblate (Turkish)
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: contract-17.0/contract-17.0-subscription_oca
Translate-URL: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-subscription_oca/
mymage and others added 4 commits September 17, 2025 13:52
Currently translated at 100.0% (164 of 164 strings)

Translation: contract-17.0/contract-17.0-subscription_oca
Translate-URL: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-subscription_oca/it/
Currently translated at 100.0% (164 of 164 strings)

Translation: contract-17.0/contract-17.0-subscription_oca
Translate-URL: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-subscription_oca/tr/
[IMP] subscription_oca: Use read_group for subscription count

Apply changes of OCA#1058

Apply changes of OCA#1224

Apply changes of OCA#1210

Apply changes of OCA#1167

subscription_oca: use get_formview_action

Fix close_reason_id visibility

Apply suggestions from review

Add "odoo 18"-like icon
@tarteo tarteo force-pushed the 18.0-mig-subscription_oca branch from 150c702 to 54f1d93 Compare September 17, 2025 11:52
@tarteo tarteo closed this Sep 17, 2025
@tarteo
Copy link
Member Author

tarteo commented Sep 17, 2025

I made a mistake with the rebase.

@tarteo
Copy link
Member Author

tarteo commented Oct 15, 2025

I've reopened the PR here: #1304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.