Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] crm_claim_code: Migration to 17.0 #593

Open
wants to merge 12 commits into
base: 17.0
Choose a base branch
from
Open
99 changes: 99 additions & 0 deletions crm_claim_code/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
==========================
Sequential Code for Claims
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:89ebffaba8772b9e473d8126709fb90d2954033a79459c97c7ed547592d31bd6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github
:target: https://github.com/OCA/crm/tree/17.0/crm_claim_code
:alt: OCA/crm
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/crm-17-0/crm-17-0-crm_claim_code
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

- This module adds a sequential code for claims.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

- Go to menu **CRM > After Sale > Claims** and create a new claim.
- Enter claim subject and Save it. You must see a new number for this
claim.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/crm/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/crm/issues/new?body=module:%20crm_claim_code%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* AvanzOSC
* Tecnativa

Contributors
------------

- Ana Juaristi <[email protected]>
- Iker Coranti <[email protected]>
- Oihane Crucelaegui <[email protected]>
- Alfredo de la Fuente <[email protected]>
- Tharathip Chaweewongphan <[email protected]>
- `Tecnativa <https://www.tecnativa.com>`__:

- Ernesto Tejeda
- Pedro M. Baeza
- Vicent Cubells

- `APSL-Nagarro <https://apsl.tech>`__:

- Bernat Obrador <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/17.0/crm_claim_code>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions crm_claim_code/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from . import models
from .hooks import create_code_equal_to_id, assign_old_sequences
18 changes: 18 additions & 0 deletions crm_claim_code/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2015-2018 Tecnativa - Pedro M. Baeza
# Copyright 2015 AvanzOsc (http://www.avanzosc.es)
# Copyright 2017 Tecnativa - Vicent Cubells <[email protected]>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

{
"name": "Sequential Code for Claims",
"version": "17.0.1.0.0",
"category": "Customer Relationship Management",
"author": "AvanzOSC, Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/crm",
"license": "AGPL-3",
"depends": ["crm_claim"],
"data": ["views/crm_claim_view.xml", "data/claim_sequence.xml"],
"installable": True,
"pre_init_hook": "create_code_equal_to_id",
"post_init_hook": "assign_old_sequences",
}
9 changes: 9 additions & 0 deletions crm_claim_code/data/claim_sequence.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo noupdate="1">
<record id="sequence_claim" model="ir.sequence">
<field name="name">Claim Code</field>
<field name="code">crm.claim</field>
<field eval="4" name="padding" />
<field name="prefix">CLM</field>
</record>
</odoo>
28 changes: 28 additions & 0 deletions crm_claim_code/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).


new_field_code_added = False


def create_code_equal_to_id(env):
env.cr.execute(
"SELECT column_name FROM information_schema.columns "
"WHERE table_name = 'crm_claim' AND column_name = 'code'"
)
if not env.cr.fetchone():
env.cr.execute("ALTER TABLE crm_claim ADD COLUMN code character varying;")
env.cr.execute("UPDATE crm_claim SET code = id;")
global new_field_code_added
new_field_code_added = True


def assign_old_sequences(env):
if not new_field_code_added:
# the field was already existing before the installation of the addon
return

Check warning on line 22 in crm_claim_code/hooks.py

View check run for this annotation

Codecov / codecov/patch

crm_claim_code/hooks.py#L22

Added line #L22 was not covered by tests

sequence_model = env["ir.sequence"]

claims = env["crm.claim"].search([], order="id")
for claim in claims:
claim.code = sequence_model.next_by_code("crm.claim")
31 changes: 31 additions & 0 deletions crm_claim_code/i18n/bg.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-05 08:31+0000\n"
"PO-Revision-Date: 2023-06-05 08:31+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: crm_claim_code
#: model:ir.model,name:crm_claim_code.model_crm_claim
msgid "Claim"
msgstr "Жалба"

#. module: crm_claim_code
#: model:ir.model.fields,field_description:crm_claim_code.field_crm_claim__code
msgid "Claim Number"
msgstr "Жалба Номер"

#. module: crm_claim_code
#: model:ir.model.constraint,message:crm_claim_code.constraint_crm_claim_crm_claim_unique_code
msgid "The code must be unique!"
msgstr "Номерът трябва да е уникален!"
29 changes: 29 additions & 0 deletions crm_claim_code/i18n/crm_claim_code.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: crm_claim_code
#: model:ir.model,name:crm_claim_code.model_crm_claim
msgid "Claim"
msgstr ""

#. module: crm_claim_code
#: model:ir.model.fields,field_description:crm_claim_code.field_crm_claim__code
msgid "Claim Number"
msgstr ""

#. module: crm_claim_code
#: model:ir.model.constraint,message:crm_claim_code.constraint_crm_claim_crm_claim_unique_code
msgid "The code must be unique!"
msgstr ""
31 changes: 31 additions & 0 deletions crm_claim_code/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-05 08:35+0000\n"
"PO-Revision-Date: 2023-06-05 08:35+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: crm_claim_code
#: model:ir.model,name:crm_claim_code.model_crm_claim
msgid "Claim"
msgstr "Reklamation"

#. module: crm_claim_code
#: model:ir.model.fields,field_description:crm_claim_code.field_crm_claim__code
msgid "Claim Number"
msgstr "Forderungsnummer"

#. module: crm_claim_code
#: model:ir.model.constraint,message:crm_claim_code.constraint_crm_claim_crm_claim_unique_code
msgid "The code must be unique!"
msgstr "Der Schlüssel muss eindeutig sein!"
31 changes: 31 additions & 0 deletions crm_claim_code/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-05 08:37+0000\n"
"PO-Revision-Date: 2023-06-05 08:37+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: crm_claim_code
#: model:ir.model,name:crm_claim_code.model_crm_claim
msgid "Claim"
msgstr "Reclamación"

#. module: crm_claim_code
#: model:ir.model.fields,field_description:crm_claim_code.field_crm_claim__code
msgid "Claim Number"
msgstr "Número de reclamación"

#. module: crm_claim_code
#: model:ir.model.constraint,message:crm_claim_code.constraint_crm_claim_crm_claim_unique_code
msgid "The code must be unique!"
msgstr "El código debe ser único."
31 changes: 31 additions & 0 deletions crm_claim_code/i18n/es_MX.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-05 08:36+0000\n"
"PO-Revision-Date: 2023-06-05 08:36+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: crm_claim_code
#: model:ir.model,name:crm_claim_code.model_crm_claim
msgid "Claim"
msgstr "Reclamación"

#. module: crm_claim_code
#: model:ir.model.fields,field_description:crm_claim_code.field_crm_claim__code
msgid "Claim Number"
msgstr "Número de reclamación"

#. module: crm_claim_code
#: model:ir.model.constraint,message:crm_claim_code.constraint_crm_claim_crm_claim_unique_code
msgid "The code must be unique!"
msgstr "El código debe ser único."
31 changes: 31 additions & 0 deletions crm_claim_code/i18n/es_VE.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-05 08:36+0000\n"
"PO-Revision-Date: 2023-06-05 08:36+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: crm_claim_code
#: model:ir.model,name:crm_claim_code.model_crm_claim
msgid "Claim"
msgstr "Reclamación"

#. module: crm_claim_code
#: model:ir.model.fields,field_description:crm_claim_code.field_crm_claim__code
msgid "Claim Number"
msgstr "Número de reclamación"

#. module: crm_claim_code
#: model:ir.model.constraint,message:crm_claim_code.constraint_crm_claim_crm_claim_unique_code
msgid "The code must be unique!"
msgstr "El código debe ser único."
31 changes: 31 additions & 0 deletions crm_claim_code/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_claim_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-05 08:35+0000\n"
"PO-Revision-Date: 2023-06-05 08:35+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: crm_claim_code
#: model:ir.model,name:crm_claim_code.model_crm_claim
msgid "Claim"
msgstr "Réclamation"

#. module: crm_claim_code
#: model:ir.model.fields,field_description:crm_claim_code.field_crm_claim__code
msgid "Claim Number"
msgstr ""

#. module: crm_claim_code
#: model:ir.model.constraint,message:crm_claim_code.constraint_crm_claim_crm_claim_unique_code
msgid "The code must be unique!"
msgstr "Le code doit être unique!"
Loading
Loading