mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
IMP project_stage Add color to Project Stage, and allow changing stage on Project form view.
Additionally, added group by "Stage" to the search view.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
'name': 'Project Stages',
|
'name': 'Project Stages',
|
||||||
'version': '11.0.1.0.0',
|
'version': '11.0.1.0.1',
|
||||||
'author': 'Hibou Corp. <hello@hibou.io>',
|
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||||
'website': 'https://hibou.io/',
|
'website': 'https://hibou.io/',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class ProjectType(models.Model):
|
|||||||
name = fields.Char(string='Stage Name', required=True, translate=True)
|
name = fields.Char(string='Stage Name', required=True, translate=True)
|
||||||
description = fields.Text(translate=True)
|
description = fields.Text(translate=True)
|
||||||
sequence = fields.Integer(default=1)
|
sequence = fields.Integer(default=1)
|
||||||
|
color = fields.Integer('Color Index')
|
||||||
fold = fields.Boolean(string='Folded in Kanban',
|
fold = fields.Boolean(string='Folded in Kanban',
|
||||||
help='This stage is folded in the kanban view when there are no records in that stage to display.')
|
help='This stage is folded in the kanban view when there are no records in that stage to display.')
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ class Project(models.Model):
|
|||||||
|
|
||||||
stage_id = fields.Many2one('project.type', string='Stage',
|
stage_id = fields.Many2one('project.type', string='Stage',
|
||||||
group_expand='_read_group_stage_ids', track_visibility='onchange', index=True)
|
group_expand='_read_group_stage_ids', track_visibility='onchange', index=True)
|
||||||
|
stage_color = fields.Integer(related='stage_id.color')
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _read_group_stage_ids(self, stages, domain, order):
|
def _read_group_stage_ids(self, stages, domain, order):
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="fold"/>
|
<field name="fold"/>
|
||||||
<field name="sequence" groups="base.group_no_one"/>
|
<field name="sequence" groups="base.group_no_one"/>
|
||||||
|
<field name="color" groups="base.group_no_one"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group string="Stage Description and Tooltips">
|
<group string="Stage Description and Tooltips">
|
||||||
@@ -102,12 +103,48 @@
|
|||||||
<field name="model">project.project</field>
|
<field name="model">project.project</field>
|
||||||
<field name="inherit_id" ref="project.view_project_kanban"/>
|
<field name="inherit_id" ref="project.view_project_kanban"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
<!-- Add `o_kanban_small_column` to prevent strange wrapping -->
|
||||||
<xpath expr="//kanban" position="attributes">
|
<xpath expr="//kanban" position="attributes">
|
||||||
<attribute name="default_group_by">stage_id</attribute>
|
<attribute name="class">o_kanban_small_column oe_background_grey o_kanban_dashboard o_project_kanban o_emphasize_colors</attribute>
|
||||||
<attribute name="on_create">quick_create</attribute>
|
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//kanban/field[@name='name']" position="after">
|
<xpath expr="//kanban/field[@name='name']" position="after">
|
||||||
<field name="stage_id" options="{'group_by_tooltip': {'description': 'Stage Description'}}"/>
|
<field name="stage_id" options="{'group_by_tooltip': {'description': 'Stage Description'}}"/>
|
||||||
|
<field name="stage_color"/>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//templates//span[@t-if='record.partner_id.value']" position="after">
|
||||||
|
<div t-if="record.stage_id.value" class="o_kanban_tags" style="margin-top: 5px;">
|
||||||
|
<span t-attf-class="o_tag o_tag_color_#{record.stage_color.raw_value}" style="font-size: 110%;">
|
||||||
|
<span style="width: 12px; height: 12px;"/>
|
||||||
|
<em><t t-esc="record.stage_id.value"/></em>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="edit_project_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">project.project.form.inherit</field>
|
||||||
|
<field name="model">project.project</field>
|
||||||
|
<field name="inherit_id" ref="project.edit_project"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//form/sheet" position="before">
|
||||||
|
<header>
|
||||||
|
<field name="stage_id" widget="statusbar" clickable="True" options="{'fold_field': 'fold'}"/>
|
||||||
|
</header>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='message_follower_ids']" position="after">
|
||||||
|
<field name="message_ids" widget="mail_thread"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_project_project_filter_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">project.project.select.inherit</field>
|
||||||
|
<field name="model">project.project</field>
|
||||||
|
<field name="inherit_id" ref="project.view_project_project_filter"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//group" position="inside">
|
||||||
|
<filter string="Stage" name="group_stage" context="{'group_by': 'stage_id'}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user