Initial commit of project_stage for 11.0

This commit is contained in:
Jared Kipe
2019-04-04 11:18:00 -07:00
parent f15919fe6b
commit 1e39d27001
5 changed files with 161 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import models

View 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,
}

View File

@@ -0,0 +1 @@
from . import project

View 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)

View 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>