Skip to content

Commit

Permalink
[IMP] add order management on project.type
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiFr82 authored and RemiFr82 committed Dec 13, 2024
1 parent 541d2e8 commit 99dc5fb
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 107 deletions.
5 changes: 5 additions & 0 deletions project_type/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ msgstr "Nom"
msgid "Parent Type"
msgstr "Type Parent"

#. module: project_type
#: model:ir.model.fields,field_description:project_type.field_project_type__sequence
msgid "Priority"
msgstr "Priorité"

#. module: project_type
#: model:ir.model,name:project_type.model_project_project
msgid "Project"
Expand Down
7 changes: 6 additions & 1 deletion project_type/i18n/fr_FR.po
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ msgstr "Nom"
#. module: project_type
#: model:ir.model.fields,field_description:project_type.field_project_type__parent_id
msgid "Parent Type"
msgstr ""
msgstr "Type parent"

#. module: project_type
#: model:ir.model.fields,field_description:project_type.field_project_type__sequence
msgid "Priority"
msgstr "Priorité"

#. module: project_type
#: model:ir.model,name:project_type.model_project_project
Expand Down
5 changes: 5 additions & 0 deletions project_type/i18n/project_type.pot
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ msgstr ""
msgid "Parent Type"
msgstr ""

#. module: project_type
#: model:ir.model.fields,field_description:project_type.field_project_type__sequence
msgid "Priority"
msgstr ""

#. module: project_type
#: model:ir.model,name:project_type.model_project_project
msgid "Project"
Expand Down
2 changes: 2 additions & 0 deletions project_type/models/project_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ProjectType(models.Model):
_name = "project.type"
_description = "Project Type"
_rec_name = "complete_name"
_order = "sequence,code,name"

parent_id = fields.Many2one(comodel_name="project.type", string="Parent Type")
child_ids = fields.One2many(
Expand All @@ -21,6 +22,7 @@ class ProjectType(models.Model):
project_ok = fields.Boolean(string="Can be applied for projects", default=True)
task_ok = fields.Boolean(string="Can be applied for tasks")
code = fields.Char(copy=False)
sequence = fields.Integer(string="Priority")

@api.constrains("parent_id")
def check_parent_id(self):
Expand Down
45 changes: 24 additions & 21 deletions project_type/views/project_project_views.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="project_search" model="ir.ui.view">
<field name="model">project.project</field>
<field name="inherit_id" ref="project.view_project_project_filter" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="type_id" />
</field>
<group expand="0">
<filter

<record id="project_search" model="ir.ui.view">
<field name="model">project.project</field>
<field name="inherit_id" ref="project.view_project_project_filter" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="type_id" />
</field>
<group expand="0">
<filter
string="Type"
name="type_id"
help="Type"
context="{'group_by':'type_id'}"
/>
</group>
</field>
</record>
<record id="project_form" model="ir.ui.view">
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project" />
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="type_id" />
</field>
</field>
</record>
</group>
</field>
</record>

<record id="project_form" model="ir.ui.view">
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project" />
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="type_id" />
</field>
</field>
</record>

</odoo>
45 changes: 24 additions & 21 deletions project_type/views/project_task_views.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="project_task_form" model="ir.ui.view">
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2" />
<field name="arch" type="xml">
<field name="tag_ids" position="after">
<field name="type_id" context="{'default_task_ok': True}" />
</field>
</field>
</record>
<record id="project_task_search" model="ir.ui.view">
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_search_form" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="type_id" />
</field>
<group expand="0">
<filter

<record id="project_task_form" model="ir.ui.view">
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2" />
<field name="arch" type="xml">
<field name="tag_ids" position="after">
<field name="type_id" context="{'default_task_ok': True}" />
</field>
</field>
</record>

<record id="project_task_search" model="ir.ui.view">
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_search_form" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="type_id" />
</field>
<group expand="0">
<filter
string="Type"
name="type_id"
help="Type"
context="{'group_by':'type_id'}"
/>
</group>
</field>
</record>
</group>
</field>
</record>

</odoo>
145 changes: 81 additions & 64 deletions project_type/views/project_type_views.xml
Original file line number Diff line number Diff line change
@@ -1,79 +1,96 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="project_type_form" model="ir.ui.view">
<field name="model">project.type</field>
<field name="arch" type="xml">
<form string="Project Type">
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1>
<field name="name" />
</h1>
<div>
<field name="project_ok" />
<label for="project_ok" />
</div>
<div>
<field name="task_ok" />
<label for="task_ok" />
</div>
</div>
<group>
<group>
<field name="parent_id" />
<field name="code" />
</group>
</group>
<notebook>
<page string="Description" name="page_description">
<field
name="description"
placeholder="Add a description..."
/>
</page>
<page string="Subtypes" name="page_subtypes">
<field name="child_ids">
<tree>
<field name="name" />
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="project_type_search" model="ir.ui.view">
<field name="model">project.type</field>
<field name="inherit_id" eval="False" />
<field name="arch" type="xml">
<search string="Type">
<field name="complete_name" />
<field name="parent_id" />
<filter

<record id="project_type_form" model="ir.ui.view">
<field name="model">project.type</field>
<field name="arch" type="xml">
<form string="Project Type">
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1>
<field name="name" />
</h1>
<div>
<field name="project_ok" />
<label for="project_ok" />
</div>
<div>
<field name="task_ok" />
<label for="task_ok" />
</div>
</div>
<group>
<group>
<field name="parent_id" />
<field name="code" />
</group>
</group>
<notebook>
<page string="Description" name="page_description">
<field name="description" placeholder="Add a description..." />
</page>
<page string="Subtypes" name="page_subtypes">
<field name="child_ids">
<tree>
<field name="name" />
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</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="sequence" widget="handle" />
<field name="code" />
<field name="name" />
<field name="project_ok" />
<field name="task_ok" />
<field name="parent_id" />
</tree>
</field>
</record>

<record id="project_type_search" model="ir.ui.view">
<field name="model">project.type</field>
<field name="inherit_id" eval="False" />
<field name="arch" type="xml">
<search string="Type">
<field name="complete_name" />
<field name="parent_id" />
<filter
name="project_ok"
string="Can be applied for projects"
string="Applicable on projects"
domain="[('project_ok','=',True)]"
/>
<filter
<filter
name="task_ok"
string="Can be applied for tasks"
string="Applicable on tasks"
domain="[('task_ok','=',True)]"
/>
</search>
</field>
</record>
<record id="action_project_type" model="ir.actions.act_window">
<field name="name">Project Types</field>
<field name="res_model">project.type</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
</search>
</field>
</record>

<record id="action_project_type" model="ir.actions.act_window">
<field name="name">Project Types</field>
<field name="res_model">project.type</field>
<field name="view_mode">tree,form</field>
</record>

<menuitem
name="Project Types"
id="project_category"
parent="project.menu_project_config"
groups="project.group_project_manager"
action="action_project_type"
sequence="20"
/>

</odoo>

0 comments on commit 99dc5fb

Please sign in to comment.