mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Initial commit of project_stage for 11.0
This commit is contained in:
1
project_stage/__init__.py
Normal file
1
project_stage/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
20
project_stage/__manifest__.py
Normal file
20
project_stage/__manifest__.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
'name': 'Project Stages',
|
||||||
|
'version': '11.0.1.0.0',
|
||||||
|
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||||
|
'website': 'https://hibou.io/',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'category': 'Tools',
|
||||||
|
'complexity': 'easy',
|
||||||
|
'description': """
|
||||||
|
Adds stages to Projects themselves.
|
||||||
|
""",
|
||||||
|
'depends': [
|
||||||
|
'project',
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'views/project_views.xml',
|
||||||
|
],
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': False,
|
||||||
|
}
|
||||||
1
project_stage/models/__init__.py
Normal file
1
project_stage/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import project
|
||||||
25
project_stage/models/project.py
Normal file
25
project_stage/models/project.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
from odoo import api, fields, models, SUPERUSER_ID
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectType(models.Model):
|
||||||
|
_name = 'project.type'
|
||||||
|
_description = 'Project Stage'
|
||||||
|
_order = 'sequence, id'
|
||||||
|
|
||||||
|
name = fields.Char(string='Stage Name', required=True, translate=True)
|
||||||
|
description = fields.Text(translate=True)
|
||||||
|
sequence = fields.Integer(default=1)
|
||||||
|
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.')
|
||||||
|
|
||||||
|
|
||||||
|
class Project(models.Model):
|
||||||
|
_inherit = 'project.project'
|
||||||
|
|
||||||
|
stage_id = fields.Many2one('project.type', string='Stage',
|
||||||
|
group_expand='_read_group_stage_ids', track_visibility='onchange', index=True)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _read_group_stage_ids(self, stages, domain, order):
|
||||||
|
stage_ids = stages._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
||||||
|
return stages.browse(stage_ids)
|
||||||
114
project_stage/views/project_views.xml
Normal file
114
project_stage/views/project_views.xml
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="open_project_type_form" model="ir.actions.act_window">
|
||||||
|
<field name="name">Project Stages</field>
|
||||||
|
<field name="res_model">project.type</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">tree,kanban,form</field>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="oe_view_nocontent_create">
|
||||||
|
Click to add a stage in the project pipeline.
|
||||||
|
</p><p>
|
||||||
|
Define the steps that will be used by projects.
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem action="open_project_type_form" id="menu_project_config_project_stage"
|
||||||
|
name="Project Stages"
|
||||||
|
parent="project.menu_project_config"
|
||||||
|
sequence="4"
|
||||||
|
groups="base.group_no_one"/>
|
||||||
|
|
||||||
|
<record id="view_project_type_kanban" model="ir.ui.view">
|
||||||
|
<field name="name">project.type.kanban</field>
|
||||||
|
<field name="model">project.type</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<kanban class="o_kanban_mobile">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="fold"/>
|
||||||
|
<field name="description"/>
|
||||||
|
<templates>
|
||||||
|
<t t-name="kanban-box">
|
||||||
|
<div t-attf-class="oe_kanban_global_click">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<strong><t t-esc="record.name.value"/></strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<t t-if="record.description.value">
|
||||||
|
<hr class="mt8 mb8"/>
|
||||||
|
<t t-esc="record.description.value"/>
|
||||||
|
</t>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
|
</kanban>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="project_type_tree" model="ir.ui.view">
|
||||||
|
<field name="name">project.type.tree</field>
|
||||||
|
<field name="model">project.type</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Project Stage">
|
||||||
|
<field name="sequence" widget="handle"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="fold"/>
|
||||||
|
<field name="description"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="project_type_search" model="ir.ui.view">
|
||||||
|
<field name="name">project.type.search</field>
|
||||||
|
<field name="model">project.type</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="Project Stages">
|
||||||
|
<field name="name" string="Project Stages"/>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="project_type_edit" model="ir.ui.view">
|
||||||
|
<field name="name">project.type.form</field>
|
||||||
|
<field name="model">project.type</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Project Stage">
|
||||||
|
<sheet>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="name"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="fold"/>
|
||||||
|
<field name="sequence" groups="base.group_no_one"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<group string="Stage Description and Tooltips">
|
||||||
|
<p class="text-muted" colspan="2">
|
||||||
|
You can also add a description to help your coworkers understand the meaning and purpose of the stage.
|
||||||
|
</p>
|
||||||
|
<field name="description" placeholder="Add a description..." nolabel="1" colspan="2"/>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Project -->
|
||||||
|
<record id="view_project_kanban_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">project.project.kanban.inherit</field>
|
||||||
|
<field name="model">project.project</field>
|
||||||
|
<field name="inherit_id" ref="project.view_project_kanban"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//kanban" position="attributes">
|
||||||
|
<attribute name="default_group_by">stage_id</attribute>
|
||||||
|
<attribute name="on_create">quick_create</attribute>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//kanban/field[@name='name']" position="after">
|
||||||
|
<field name="stage_id" options="{'group_by_tooltip': {'description': 'Stage Description'}}"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user