From 795b94408757d07362980f18fd61ccff256b23de Mon Sep 17 00:00:00 2001 From: bobrador Date: Wed, 7 Aug 2024 15:18:44 +0200 Subject: [PATCH] [MIG] crm_claim_code: Migration to 17.0 --- crm_claim_code/README.rst | 4 ++++ crm_claim_code/__manifest__.py | 2 +- crm_claim_code/hooks.py | 14 +++++++------- crm_claim_code/models/crm_claim.py | 1 - crm_claim_code/readme/CONTRIBUTORS.md | 2 ++ crm_claim_code/static/description/index.html | 4 ++++ crm_claim_code/views/crm_claim_view.xml | 4 ++-- 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/crm_claim_code/README.rst b/crm_claim_code/README.rst index dbb4686654a..cbb31130a77 100644 --- a/crm_claim_code/README.rst +++ b/crm_claim_code/README.rst @@ -77,6 +77,10 @@ Contributors - Pedro M. Baeza - Vicent Cubells +- `APSL-Nagarro `__: + + - Bernat Obrador + Maintainers ----------- diff --git a/crm_claim_code/__manifest__.py b/crm_claim_code/__manifest__.py index 44c176333ba..65c3b39d7f6 100644 --- a/crm_claim_code/__manifest__.py +++ b/crm_claim_code/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Sequential Code for Claims", - "version": "16.0.1.0.1", + "version": "17.0.1.0.1", "category": "Customer Relationship Management", "author": "AvanzOSC, Tecnativa, Odoo Community Association (OCA)", "website": "https://github.com/OCA/crm", diff --git a/crm_claim_code/hooks.py b/crm_claim_code/hooks.py index 5a07394cb7d..4bedc01d32b 100644 --- a/crm_claim_code/hooks.py +++ b/crm_claim_code/hooks.py @@ -6,24 +6,24 @@ new_field_code_added = False -def create_code_equal_to_id(cr): - cr.execute( +def create_code_equal_to_id(env): + env.execute( "SELECT column_name FROM information_schema.columns " "WHERE table_name = 'crm_claim' AND column_name = 'code'" ) - if not cr.fetchone(): - cr.execute("ALTER TABLE crm_claim ADD COLUMN code character varying;") - cr.execute("UPDATE crm_claim SET code = id;") + if not env.fetchone(): + env.execute("ALTER TABLE crm_claim ADD COLUMN code character varying;") + env.execute("UPDATE crm_claim SET code = id;") global new_field_code_added new_field_code_added = True -def assign_old_sequences(cr, registry): +def assign_old_sequences(env): if not new_field_code_added: # the field was already existing before the installation of the addon return - env = Environment(cr, SUPERUSER_ID, {}) + env = Environment(env, SUPERUSER_ID, {}) sequence_model = env["ir.sequence"] diff --git a/crm_claim_code/models/crm_claim.py b/crm_claim_code/models/crm_claim.py index b278122016b..a8c73d80174 100644 --- a/crm_claim_code/models/crm_claim.py +++ b/crm_claim_code/models/crm_claim.py @@ -13,7 +13,6 @@ class CrmClaim(models.Model): string="Claim Number", required=True, default="/", - readonly=True, copy=False, ) diff --git a/crm_claim_code/readme/CONTRIBUTORS.md b/crm_claim_code/readme/CONTRIBUTORS.md index 1f18d5b736b..8ac9792dc32 100644 --- a/crm_claim_code/readme/CONTRIBUTORS.md +++ b/crm_claim_code/readme/CONTRIBUTORS.md @@ -7,3 +7,5 @@ - Ernesto Tejeda - Pedro M. Baeza - Vicent Cubells +- [APSL-Nagarro](): + - Bernat Obrador \<\> diff --git a/crm_claim_code/static/description/index.html b/crm_claim_code/static/description/index.html index 5c8c377c2f5..c4209408abd 100644 --- a/crm_claim_code/static/description/index.html +++ b/crm_claim_code/static/description/index.html @@ -426,6 +426,10 @@

Contributors

  • Vicent Cubells
  • +
  • APSL-Nagarro: +
  • diff --git a/crm_claim_code/views/crm_claim_view.xml b/crm_claim_code/views/crm_claim_view.xml index 2caf296c127..241e31d6fb8 100644 --- a/crm_claim_code/views/crm_claim_view.xml +++ b/crm_claim_code/views/crm_claim_view.xml @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - +