diff --git a/base_kanban_stage/README.rst b/base_kanban_stage/README.rst
new file mode 100644
index 000000000..8f683f429
--- /dev/null
+++ b/base_kanban_stage/README.rst
@@ -0,0 +1,110 @@
+.. image:: https://img.shields.io/badge/licence-lgpl--3-blue.svg
+ :target: http://www.gnu.org/licenses/LGPL-3.0-standalone.html
+ :alt: License: LGPL-3
+
+======================
+Kanban - Stage Support
+======================
+
+This module provides a stage model compatible with Kanban views and the
+standard views needed to manage these stages. It also provides the
+``base.kanban.abstract`` model, which can be inherited to add support for
+Kanban views with stages to any other model. Lastly, it includes a base Kanban
+view that can be extended as needed.
+
+Installation
+============
+
+To install this module, simply follow the standard install process.
+
+Configuration
+=============
+
+No configuration is needed or possible.
+
+Usage
+=====
+
+* Inherit from ``base.kanban.abstract`` to add Kanban stage functionality to
+ the child model:
+
+ .. code-block:: python
+
+ class MyModel(models.Model):
+ _name = 'my.model'
+ _inherit = 'base.kanban.abstract'
+
+* Extend the provided base Kanban view (``base_kanban_abstract_view_kanban``)
+ as needed by the child model while making sure to set the ``mode`` to
+ ``primary`` so that inheritance works properly. The base view has four
+ ``name`` attributes intended to provide convenient XPath access to different
+ parts of the Kanban card. They are ``card_dropdown_menu``, ``card_header``,
+ ``card_body``, and ``card_footer``:
+
+ .. code-block:: xml
+
+
+ My Model - Kanban View
+ my.model
+ primary
+
+
+
+
+
+
+
+
+
+
+
+* To manage stages, go to Settings > Technical > Kanban > Stages.
+
+.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
+ :alt: Try me on Runbot
+ :target: https://runbot.odoo-community.org/runbot/162/10.0
+
+Known Issues / Roadmap
+======================
+
+* The grouping logic used by ``base.kanban.abstract`` currently does not
+ support additional domains and alternate sort orders
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub 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.
+
+Credits
+=======
+
+Images
+------
+
+* Odoo Community Association:
+ `Icon `_.
+
+Contributors
+------------
+
+* Dave Lasley
+* Oleg Bulkin
+* Daniel Reis
+
+Maintainer
+----------
+
+.. image:: https://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: https://odoo-community.org
+
+This module is maintained by the OCA.
+
+OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
+To contribute to this module, please visit http://odoo-community.org.
diff --git a/base_kanban_stage/__init__.py b/base_kanban_stage/__init__.py
new file mode 100644
index 000000000..6b7b00c35
--- /dev/null
+++ b/base_kanban_stage/__init__.py
@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+# Copyright 2016 LasLabs Inc.
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+
+from . import models
diff --git a/base_kanban_stage/__manifest__.py b/base_kanban_stage/__manifest__.py
new file mode 100644
index 000000000..ecb053f2f
--- /dev/null
+++ b/base_kanban_stage/__manifest__.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Copyright 2016 LasLabs Inc.
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+
+{
+ 'name': 'Kanban - Stage Support',
+ 'summary': 'Provides stage model and abstract logic for inheritance',
+ 'version': '10.0.1.0.0',
+ 'author': "LasLabs, Odoo Community Association (OCA)",
+ 'category': 'base',
+ 'depends': [
+ 'base',
+ ],
+ 'website': 'https://laslabs.com',
+ 'license': 'LGPL-3',
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'views/base_kanban_abstract.xml',
+ 'views/base_kanban_stage.xml',
+ ],
+ 'installable': True,
+ 'application': False,
+}
diff --git a/base_kanban_stage/models/__init__.py b/base_kanban_stage/models/__init__.py
new file mode 100644
index 000000000..abde8b5bd
--- /dev/null
+++ b/base_kanban_stage/models/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# Copyright 2016 LasLabs Inc.
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+
+from . import base_kanban_abstract
+from . import base_kanban_stage
diff --git a/base_kanban_stage/models/base_kanban_abstract.py b/base_kanban_stage/models/base_kanban_abstract.py
new file mode 100644
index 000000000..391c5edda
--- /dev/null
+++ b/base_kanban_stage/models/base_kanban_abstract.py
@@ -0,0 +1,110 @@
+# -*- coding: utf-8 -*-
+# Copyright 2016 LasLabs Inc.
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+
+from odoo import api, fields, models
+
+
+class BaseKanbanAbstract(models.AbstractModel):
+ """ Inherit from this class to add support for Kanban stages to your model.
+ All public properties are preceded with kanban_ in order to isolate from
+ child models, with the exception of stage_id, which is a required field in
+ the Kanban widget and must be defined as such. """
+
+ _name = 'base.kanban.abstract'
+ _order = 'kanban_priority desc, kanban_sequence'
+ _group_by_full = {
+ 'stage_id': lambda s, *a, **k: s._read_group_stage_ids(*a, **k),
+ }
+
+ kanban_sequence = fields.Integer(
+ default=10,
+ index=True,
+ help='Order of record in relation to other records in the same Kanban'
+ ' stage and with the same priority',
+ )
+ kanban_priority = fields.Selection(
+ selection=[('0', 'Normal'), ('1', 'Medium'), ('2', 'High')],
+ index=True,
+ default='0',
+ help='The priority of the record (shown as stars in Kanban views)',
+ )
+ stage_id = fields.Many2one(
+ string='Kanban Stage',
+ comodel_name='base.kanban.stage',
+ track_visibility='onchange',
+ index=True,
+ copy=False,
+ help='The Kanban stage that this record is currently in',
+ default=lambda s: s._default_stage_id(),
+ domain=lambda s: [('res_model_id.model', '=', s._name)],
+ group_expand='_read_group_stage_ids',
+ )
+ user_id = fields.Many2one(
+ string='Assigned To',
+ comodel_name='res.users',
+ index=True,
+ track_visibility='onchange',
+ help='User that the record is currently assigned to',
+ )
+ kanban_color = fields.Integer(
+ string='Color Index',
+ help='Color index to be used for the record\'s Kanban card',
+ )
+ kanban_legend_priority = fields.Text(
+ string='Priority Explanation',
+ related='stage_id.legend_priority',
+ help='Explanation text to help users understand how the priority/star'
+ ' mechanism applies to this record (depends on current stage)',
+ )
+ kanban_legend_blocked = fields.Text(
+ string='Special Handling Explanation',
+ related='stage_id.legend_blocked',
+ help='Explanation text to help users understand how the special'
+ ' handling status applies to this record (depends on current'
+ ' stage)',
+ )
+ kanban_legend_done = fields.Text(
+ string='Ready Explanation',
+ related='stage_id.legend_done',
+ help='Explanation text to help users understand how the ready'
+ ' status applies to this record (depends on current stage)',
+ )
+ kanban_legend_normal = fields.Text(
+ string='Normal Handling Explanation',
+ related='stage_id.legend_normal',
+ help='Explanation text to help users understand how the normal'
+ ' handling status applies to this record (depends on current'
+ ' stage)',
+ )
+ kanban_status = fields.Selection(
+ selection=[
+ ('normal', 'Normal Handling'),
+ ('done', 'Ready'),
+ ('blocked', 'Special Handling'),
+ ],
+ string='Kanban Status',
+ default='normal',
+ track_visibility='onchange',
+ required=True,
+ copy=False,
+ help='A record can have one of several Kanban statuses, which are used'
+ ' to indicate whether there are any special situations affecting'
+ ' it. The exact meaning of each status is allowed to vary based'
+ ' on the stage the record is in but they are roughly as follow:\n'
+ '* Normal Handling: Default status, no special situations\n'
+ '* Ready: Ready to transition to the next stage\n'
+ '* Special Handling: Blocked in some way (e.g. must be handled by'
+ ' a specific user)\n'
+ )
+
+ @api.model
+ def _default_stage_id(self):
+ return self.env['base.kanban.stage']
+
+ @api.multi
+ def _read_group_stage_ids(self, stages, domain, order):
+ search_domain = [('res_model_id.model', '=', self._name)]
+ if domain:
+ search_domain.extend(domain)
+ return stages.search(search_domain, order=order)
diff --git a/base_kanban_stage/models/base_kanban_stage.py b/base_kanban_stage/models/base_kanban_stage.py
new file mode 100644
index 000000000..2ffaa63ec
--- /dev/null
+++ b/base_kanban_stage/models/base_kanban_stage.py
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+# Copyright 2016 LasLabs Inc.
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+
+from odoo import api, fields, models
+
+
+class BaseKanbanStage(models.Model):
+ _name = 'base.kanban.stage'
+ _description = 'Kanban Stage'
+ _order = 'res_model_id, sequence'
+
+ name = fields.Char(
+ string='Stage Name',
+ translate=True,
+ required=True,
+ help='Displayed as the header for this stage in Kanban views',
+ )
+ description = fields.Text(
+ translate=True,
+ help='Short description of the stage\'s meaning/purpose',
+ )
+ sequence = fields.Integer(
+ default=1,
+ required=True,
+ index=True,
+ help='Order of stage in relation to other stages available for the'
+ ' same model',
+ )
+ legend_priority = fields.Text(
+ string='Priority Explanation',
+ translate=True,
+ default='Mark a card as medium or high priority (one or two stars) to'
+ ' indicate that it should be escalated ahead of others with'
+ ' lower priority/star counts.',
+ help='Explanation text to help users understand how the priority/star'
+ ' mechanism applies to this stage',
+ )
+ legend_blocked = fields.Text(
+ string='Special Handling Explanation',
+ translate=True,
+ default='Give a card the special handling status to indicate that it'
+ ' requires handling by a special user or subset of users.',
+ help='Explanation text to help users understand how the special'
+ ' handling status applies to this stage',
+ )
+ legend_done = fields.Text(
+ string='Ready Explanation',
+ translate=True,
+ default='Mark a card as ready when it has been fully processed.',
+ help='Explanation text to help users understand how the ready status'
+ ' applies to this stage',
+ )
+ legend_normal = fields.Text(
+ string='Normal Handling Explanation',
+ translate=True,
+ default='This is the default status and indicates that a card can be'
+ ' processed by any user working this queue.',
+ help='Explanation text to help users understand how the normal'
+ ' handling status applies to this stage',
+ )
+ fold = fields.Boolean(
+ string='Collapse?',
+ help='Determines whether this stage will be collapsed down in Kanban'
+ ' views',
+ )
+ res_model_id = fields.Many2one(
+ string='Associated Model',
+ comodel_name='ir.model',
+ required=True,
+ index=True,
+ help='The model that this Kanban stage will be used for',
+ domain=[('transient', '=', False)],
+ default=lambda s: s._default_res_model_id(),
+ )
+
+ @api.model
+ def _default_res_model_id(self):
+ '''Useful when creating stages from a Kanban view for another model'''
+ action_id = self.env.context.get('params', {}).get('action')
+ action = self.env['ir.actions.act_window'].browse(action_id)
+ default_model = action.res_model
+ if default_model != self._name:
+ return self.env['ir.model'].search([('model', '=', default_model)])
diff --git a/base_kanban_stage/security/ir.model.access.csv b/base_kanban_stage/security/ir.model.access.csv
new file mode 100644
index 000000000..b47795a31
--- /dev/null
+++ b/base_kanban_stage/security/ir.model.access.csv
@@ -0,0 +1,3 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_user,Kanban Stage - User Access,model_base_kanban_stage,base.group_user,1,0,0,0
+access_manager,Kanban Stage - Manager Access,model_base_kanban_stage,base.group_erp_manager,1,1,1,1
diff --git a/base_kanban_stage/static/description/icon.png b/base_kanban_stage/static/description/icon.png
new file mode 100644
index 000000000..3a0328b51
Binary files /dev/null and b/base_kanban_stage/static/description/icon.png differ
diff --git a/base_kanban_stage/tests/__init__.py b/base_kanban_stage/tests/__init__.py
new file mode 100644
index 000000000..05cdecf9a
--- /dev/null
+++ b/base_kanban_stage/tests/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# Copyright 2016 LasLabs Inc.
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+
+from . import test_base_kanban_abstract
+from . import test_base_kanban_stage
diff --git a/base_kanban_stage/tests/test_base_kanban_abstract.py b/base_kanban_stage/tests/test_base_kanban_abstract.py
new file mode 100644
index 000000000..cf564f7e0
--- /dev/null
+++ b/base_kanban_stage/tests/test_base_kanban_abstract.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+# Copyright 2016 LasLabs Inc.
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+
+from odoo import models
+from odoo.tests.common import SavepointCase
+
+
+class BaseKanbanAbstractTester(models.TransientModel):
+ _name = 'base.kanban.abstract.tester'
+ _inherit = 'base.kanban.abstract'
+
+
+class TestBaseKanbanAbstract(SavepointCase):
+
+ @classmethod
+ def _init_test_model(cls, model_cls):
+ """ It builds a model from model_cls in order to test abstract models.
+
+ Note that this does not actually create a table in the database, so
+ there may be some unidentified edge cases.
+
+ Args:
+ model_cls (openerp.models.BaseModel): Class of model to initialize
+ Returns:
+ model_cls: Instance
+ """
+ registry = cls.env.registry
+ cr = cls.env.cr
+ inst = model_cls._build_model(registry, cr)
+ model = cls.env[model_cls._name].with_context(todo=[])
+ model._prepare_setup()
+ model._setup_base(partial=False)
+ model._setup_fields(partial=False)
+ model._setup_complete()
+ model._auto_init()
+ model.init()
+ model._auto_end()
+ cls.test_model_record = cls.env['ir.model'].search([
+ ('name', '=', model._name),
+ ])
+ return inst
+
+ @classmethod
+ def setUpClass(cls):
+ super(TestBaseKanbanAbstract, cls).setUpClass()
+ cls.env.registry.enter_test_mode()
+ cls._init_test_model(BaseKanbanAbstractTester)
+ cls.test_model = cls.env[BaseKanbanAbstractTester._name]
+
+ def setUp(self):
+ super(TestBaseKanbanAbstract, self).setUp()
+ test_stage_1 = self.env['base.kanban.stage'].create({
+ 'name': 'Test Stage 1',
+ 'res_model_id': self.test_model_record.id,
+ })
+ test_stage_2 = self.env['base.kanban.stage'].create({
+ 'name': 'Test Stage 2',
+ 'res_model_id': self.test_model_record.id,
+ 'fold': True,
+ })
+
+ self.id_1 = test_stage_1.id
+ self.id_2 = test_stage_2.id
+
+ def test_read_group_stage_ids(self):
+ """It should return the correct recordset. """
+ self.assertEqual(
+ self.test_model._read_group_stage_ids(
+ self.env['base.kanban.stage'], [], 'id',
+ ),
+ self.env['base.kanban.stage'].search([], order='id'),
+ )
+
+ def test_default_stage_id(self):
+ """ It should return an empty RecordSet """
+ self.assertEqual(
+ self.env['base.kanban.abstract']._default_stage_id(),
+ self.env['base.kanban.stage']
+ )
diff --git a/base_kanban_stage/tests/test_base_kanban_stage.py b/base_kanban_stage/tests/test_base_kanban_stage.py
new file mode 100644
index 000000000..e2d3e9bfa
--- /dev/null
+++ b/base_kanban_stage/tests/test_base_kanban_stage.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2016 LasLabs Inc.
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
+
+from odoo.tests.common import TransactionCase
+
+
+class TestBaseKanbanStage(TransactionCase):
+ def test_default_res_model_id_no_params(self):
+ '''It should return empty ir.model Recordset if no params in context'''
+ test_stage = self.env['base.kanban.stage'].with_context({})
+ res_model_id = test_stage._default_res_model_id()
+
+ self.assertFalse(res_model_id)
+ self.assertEqual(res_model_id._name, 'ir.model')
+
+ def test_default_res_model_id_no_action(self):
+ '''It should return empty ir.model Recordset if no action in params'''
+ test_stage = self.env['base.kanban.stage'].with_context(params={})
+ res_model_id = test_stage._default_res_model_id()
+
+ self.assertFalse(res_model_id)
+ self.assertEqual(res_model_id._name, 'ir.model')
+
+ def test_default_res_model_id_info_in_context(self):
+ '''It should return correct ir.model record if info in context'''
+ test_action = self.env['ir.actions.act_window'].create({
+ 'name': 'Test Action',
+ 'res_model': 'res.users',
+ })
+ test_stage = self.env['base.kanban.stage'].with_context(
+ params={'action': test_action.id},
+ )
+
+ self.assertEqual(
+ test_stage._default_res_model_id(),
+ self.env['ir.model'].search([('model', '=', 'res.users')])
+ )
+
+ def test_default_res_model_id_ignore_self(self):
+ '''It should not return ir.model record corresponding to stage model'''
+ test_action = self.env['ir.actions.act_window'].create({
+ 'name': 'Test Action',
+ 'res_model': 'base.kanban.stage',
+ })
+ test_stage = self.env['base.kanban.stage'].with_context(
+ params={'action': test_action.id},
+ )
+
+ self.assertFalse(test_stage._default_res_model_id())
diff --git a/base_kanban_stage/views/base_kanban_abstract.xml b/base_kanban_stage/views/base_kanban_abstract.xml
new file mode 100644
index 000000000..984889565
--- /dev/null
+++ b/base_kanban_stage/views/base_kanban_abstract.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+ Kanban Abstract - Base Kanban View
+ base.kanban.abstract
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/base_kanban_stage/views/base_kanban_stage.xml b/base_kanban_stage/views/base_kanban_stage.xml
new file mode 100644
index 000000000..4a73fb674
--- /dev/null
+++ b/base_kanban_stage/views/base_kanban_stage.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+ Kanban Stage - Form View
+ base.kanban.stage
+
+
+
+
+
+
+ Kanban Stages - Tree View
+ base.kanban.stage
+
+
+
+
+
+
+
+
+
+
+ Kanban Stages - Search View
+ base.kanban.stage
+
+
+
+
+
+
+
+
+
+
+ Kanban Stages
+ base.kanban.stage
+ ir.actions.act_window
+ form
+ tree,form
+
+
+
+
+
+