Browse Source

Merge pull request #760 from LasLabs/base-kanban-stage-state

[10.0] Add base_kanban_stage_state: Map stages to states
pull/781/head
Moises Lopez - https://www.vauxoo.com/ 8 years ago
committed by GitHub
parent
commit
032babcfd2
  1. 67
      base_kanban_stage_state/README.rst
  2. 5
      base_kanban_stage_state/__init__.py
  3. 20
      base_kanban_stage_state/__manifest__.py
  4. 5
      base_kanban_stage_state/models/__init__.py
  5. 20
      base_kanban_stage_state/models/base_kanban_stage.py
  6. BIN
      base_kanban_stage_state/static/description/icon.png
  7. 5
      base_kanban_stage_state/tests/__init__.py
  8. 20
      base_kanban_stage_state/tests/test_base_kanban_stage.py
  9. 18
      base_kanban_stage_state/views/base_kanban_stage_state_view.xml

67
base_kanban_stage_state/README.rst

@ -0,0 +1,67 @@
.. 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
=======================
Base Kanban Stage State
=======================
This module extends the functionality of base_kanban_stage to allow you to
map stages from base_kanban_stage to states. The states are:
*. New (draft)
*. In Progress (open)
*. Pending (pending)
*. Done (done)
*. Cancelled (cancelled)
*. Exception (exception)
Usage
=====
To use this module, you need to:
#. Go to ...
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/10.0
Known issues / Roadmap
======================
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/sever-tools/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 <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Kelly Lougheed <kelly@smdrugstore.com>
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 https://odoo-community.org.

5
base_kanban_stage_state/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Specialty Medical Drugstore
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import models

20
base_kanban_stage_state/__manifest__.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Specialty Medical Drugstore
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Base Kanban Stage State",
"summary": "Maps stages from base_kanban_stage to states",
"version": "10.0.1.0.0",
"category": "Base",
"website": "https://odoo-community.org/",
"author": "SMDrugstore, Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": [
"base_kanban_stage",
],
"data": [
"views/base_kanban_stage_state_view.xml",
],
}

5
base_kanban_stage_state/models/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Specialty Medical Drugstore
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import base_kanban_stage

20
base_kanban_stage_state/models/base_kanban_stage.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Specialty Medical Drugstore
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import api, fields, models
class BaseKanbanStage(models.Model):
_inherit = 'base.kanban.stage'
@api.model
def _get_states(self):
return [('draft', 'New'),
('open', 'In Progress'),
('pending', 'Pending'),
('done', 'Done'),
('cancelled', 'Cancelled'),
('exception', 'Exception')]
state = fields.Selection(_get_states, 'State')

BIN
base_kanban_stage_state/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

5
base_kanban_stage_state/tests/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Specialty Medical Drugstore
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_base_kanban_stage

20
base_kanban_stage_state/tests/test_base_kanban_stage.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Specialty Medical Drugstore
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo.tests.common import TransactionCase
class TestBaseKanbanStage(TransactionCase):
def test_get_states(self):
'''It should return a list of stages'''
test_stage = self.env['base.kanban.stage'].with_context({})
self.assertEqual(test_stage._get_states(),
[('draft', 'New'),
('open', 'In Progress'),
('pending', 'Pending'),
('done', 'Done'),
('cancelled', 'Cancelled'),
('exception', 'Exception')]
)

18
base_kanban_stage_state/views/base_kanban_stage_state_view.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Specialty Medical Drugstore
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<odoo>
<record id="base_kanban_stage_view_form" model="ir.ui.view">
<field name="name">Kanban Stage - Form View</field>
<field name="model">base.kanban.stage</field>
<field name="inherit_id" ref="base_kanban_stage.base_kanban_stage_view_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='core_info']" position="inside">
<field name="state"/>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save