Skip to content

Commit

Permalink
[16.0][ADD] project_type_sequence: New field "Sequence" in project type.
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredoavanzosc committed Oct 14, 2024
1 parent 5957987 commit dc6c8b7
Show file tree
Hide file tree
Showing 15 changed files with 344 additions and 0 deletions.
30 changes: 30 additions & 0 deletions project_type_sequence/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=====================
Project type sequence
=====================

* When a project is created and is associated with a project type with a
defined sequence, the new project will be registered with said sequence,
otherwise the general sequence for projects will be used.

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

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/project-addons/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted
it first, help us smash it by providing detailed and welcomed feedback.

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

Credits
=======

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

* Ana Juaristi <anajuaristi@avanzosc.es>
* Alfredo de la Fuente <alfredodelafuente@avanzosc.es>
1 change: 1 addition & 0 deletions project_type_sequence/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions project_type_sequence/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2026 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Project Type Sequence",
"version": "16.0.1.0.0",
"category": "Services/Project",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/project-addons",
"depends": ["project_type", "project_sequence"],
"data": [
"views/project_type_views.xml",
"views/project_project_views.xml",
],
"installable": True,
}
36 changes: 36 additions & 0 deletions project_type_sequence/i18n/ca_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_type_sequence
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-14 09:26+0000\n"
"PO-Revision-Date: 2024-10-14 09:26+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: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_project
msgid "Project"
msgstr "Projecte"

#. module: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_type
msgid "Project Type"
msgstr "Tipus de Projectes"

#. module: project_type_sequence
#: model:ir.model.fields,field_description:project_type_sequence.field_project_type__sequence_id
msgid "Sequence"
msgstr ""

#. module: project_type_sequence
#: model_terms:ir.ui.view,arch_db:project_type_sequence.project_project_view_form_simplified
msgid "Type of project"
msgstr ""
36 changes: 36 additions & 0 deletions project_type_sequence/i18n/en_GB.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_type_sequence
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-14 09:27+0000\n"
"PO-Revision-Date: 2024-10-14 09:27+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: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_project
msgid "Project"
msgstr ""

#. module: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_type
msgid "Project Type"
msgstr ""

#. module: project_type_sequence
#: model:ir.model.fields,field_description:project_type_sequence.field_project_type__sequence_id
msgid "Sequence"
msgstr ""

#. module: project_type_sequence
#: model_terms:ir.ui.view,arch_db:project_type_sequence.project_project_view_form_simplified
msgid "Type of project"
msgstr ""
36 changes: 36 additions & 0 deletions project_type_sequence/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_type_sequence
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-14 09:27+0000\n"
"PO-Revision-Date: 2024-10-14 09:27+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: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_project
msgid "Project"
msgstr "Proyecto"

#. module: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_type
msgid "Project Type"
msgstr "Tipos de Proyectos"

#. module: project_type_sequence
#: model:ir.model.fields,field_description:project_type_sequence.field_project_type__sequence_id
msgid "Sequence"
msgstr "Secuencia"

#. module: project_type_sequence
#: model_terms:ir.ui.view,arch_db:project_type_sequence.project_project_view_form_simplified
msgid "Type of project"
msgstr "Tipo de proyecto"
36 changes: 36 additions & 0 deletions project_type_sequence/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_type_sequence
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-14 09:27+0000\n"
"PO-Revision-Date: 2024-10-14 09:27+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: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_project
msgid "Project"
msgstr "Projet"

#. module: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_type
msgid "Project Type"
msgstr "Type de projet"

#. module: project_type_sequence
#: model:ir.model.fields,field_description:project_type_sequence.field_project_type__sequence_id
msgid "Sequence"
msgstr ""

#. module: project_type_sequence
#: model_terms:ir.ui.view,arch_db:project_type_sequence.project_project_view_form_simplified
msgid "Type of project"
msgstr ""
36 changes: 36 additions & 0 deletions project_type_sequence/i18n/project_type_sequence.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_type_sequence
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-14 09:26+0000\n"
"PO-Revision-Date: 2024-10-14 09:26+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: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_project
msgid "Project"
msgstr ""

#. module: project_type_sequence
#: model:ir.model,name:project_type_sequence.model_project_type
msgid "Project Type"
msgstr ""

#. module: project_type_sequence
#: model:ir.model.fields,field_description:project_type_sequence.field_project_type__sequence_id
msgid "Sequence"
msgstr ""

#. module: project_type_sequence
#: model_terms:ir.ui.view,arch_db:project_type_sequence.project_project_view_form_simplified
msgid "Type of project"
msgstr ""
2 changes: 2 additions & 0 deletions project_type_sequence/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import project_type
from . import project_project
22 changes: 22 additions & 0 deletions project_type_sequence/models/project_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2026 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, models


class ProjectProject(models.Model):
_inherit = "project.project"

@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if "name" in vals:
vals.pop("name")
if (
"sequence_code" not in vals
and "type_id" in vals
and vals.get("type_id", False)
):
project_type = self.env["project.type"].browse(vals.get("type_id"))
if project_type.sequence_id:
vals["sequence_code"] = project_type.sequence_id.next_by_id()
return super().create(vals_list)
9 changes: 9 additions & 0 deletions project_type_sequence/models/project_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2026 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


class ProjectType(models.Model):
_inherit = "project.type"

sequence_id = fields.Many2one(string="Sequence", comodel_name="ir.sequence")
43 changes: 43 additions & 0 deletions project_type_sequence/views/project_project_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record model="ir.ui.view" id="project_project_view_form_simplified">
<field name="model">project.project</field>
<field name="inherit_id" ref="project.project_project_view_form_simplified" />
<field name="arch" type="xml">
<field name="user_id" position="before">
<div name="project-type">
<label
for="type_id"
class="oe_inline mt-4"
string="Type of project"
/>
<field name="type_id" />
</div>
</field>
</field>
</record>

<record model="ir.ui.view" id="project_sequence_form_view">
<field name="model">project.project</field>
<field name="inherit_id" ref="project_sequence.project_sequence_form_view" />
<field name="arch" type="xml">
<div name="sequence_code" position="attributes">
<attribute name="invisible">1</attribute>
</div>
</field>
</record>

<record model="ir.ui.view" id="project_sequence_tree_view">
<field name="model">project.project</field>
<field name="inherit_id" ref="project_sequence.project_sequence_tree_view" />
<field name="arch" type="xml">
<field name="sequence_code" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>

<record model="ir.ui.view" id="project_sequence.project_sequence_search_view">
<field name="active">False</field>
</record>
</odoo>
34 changes: 34 additions & 0 deletions project_type_sequence/views/project_type_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record model="ir.ui.view" id="project_type_form">
<field name="model">project.type</field>
<field name="inherit_id" ref="project_type.project_type_form" />
<field name="arch" type="xml">
<field name="code" position="before">
<field name="sequence_id" />
</field>
</field>
</record>

<record model="ir.ui.view" id="project_type_search">
<field name="model">project.type</field>
<field name="inherit_id" ref="project_type.project_type_search" />
<field name="arch" type="xml">
<field name="parent_id" position="after">
<field name="sequence_id" />
</field>
</field>
</record>

<record id="project_type_tree" model="ir.ui.view">
<field name="model">project.type</field>
<field name="arch" type="xml">
<tree>
<field name="complete_name" />
<field name="sequence_id" optional="show" />
<field name="project_ok" optional="show" />
<field name="task_ok" optional="show" />
</tree>
</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/project_type_sequence/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit dc6c8b7

Please sign in to comment.