Browse Source

Add _get_states method and tests

pull/760/head
Kelly Lougheed 8 years ago
parent
commit
59c78ceb9a
  1. 16
      base_kanban_stage_state/models/base_kanban_stage.py
  2. 5
      base_kanban_stage_state/tests/__init__.py
  3. 20
      base_kanban_stage_state/tests/test_base_kanban_stage.py

16
base_kanban_stage_state/models/base_kanban_stage.py

@ -2,19 +2,19 @@
# Copyright 2017 Specialty Medical Drugstore
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import fields, models
from odoo import api, fields, models
_STATE = [
('draft', 'New'),
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')]
class BaseKanbanStage(models.Model):
_inherit = 'base.kanban.stage'
state = fields.Selection(_STATE, 'State')
state = fields.Selection(_get_states, 'State')

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')]
)
Loading…
Cancel
Save