|
@ -5,18 +5,17 @@ from openerp import exceptions |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestPosRequireCustomer(common.TransactionCase): |
|
|
class TestPosRequireCustomer(common.TransactionCase): |
|
|
|
|
|
|
|
|
def setUp(self): |
|
|
def setUp(self): |
|
|
super(TestPosRequireCustomer, self).setUp() |
|
|
super(TestPosRequireCustomer, self).setUp() |
|
|
|
|
|
|
|
|
def test_customer_not_required(self): |
|
|
def test_customer_not_required(self): |
|
|
|
|
|
|
|
|
posconfig = self.env.ref('point_of_sale.pos_config_main') |
|
|
posconfig = self.env.ref('point_of_sale.pos_config_main') |
|
|
posconfig.require_customer = False |
|
|
posconfig.require_customer = False |
|
|
|
|
|
|
|
|
pos_session = self.env['pos.session'].create({'config_id': |
|
|
|
|
|
posconfig.id}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Now Create new session and create a |
|
|
|
|
|
# pos order in this session |
|
|
|
|
|
pos_session = self.env['pos.session'].create( |
|
|
|
|
|
{'config_id': posconfig.id}) |
|
|
# should not raise any exception |
|
|
# should not raise any exception |
|
|
self.env['pos.order'].create({ |
|
|
self.env['pos.order'].create({ |
|
|
'session_id': pos_session.id, |
|
|
'session_id': pos_session.id, |
|
@ -24,13 +23,13 @@ class TestPosRequireCustomer(common.TransactionCase): |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
def test_customer_is_required(self): |
|
|
def test_customer_is_required(self): |
|
|
|
|
|
|
|
|
posconfig = self.env.ref('point_of_sale.pos_config_main') |
|
|
posconfig = self.env.ref('point_of_sale.pos_config_main') |
|
|
posconfig.require_customer = True |
|
|
posconfig.require_customer = True |
|
|
|
|
|
|
|
|
pos_session = self.env['pos.session'].create({'config_id': |
|
|
|
|
|
posconfig.id}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Now Create new session and create a |
|
|
|
|
|
# pos order in this session |
|
|
|
|
|
pos_session = self.env['pos.session'].create( |
|
|
|
|
|
{'config_id': posconfig.id}) |
|
|
# should raise exceptions.ValidationError |
|
|
# should raise exceptions.ValidationError |
|
|
self.assertRaises( |
|
|
self.assertRaises( |
|
|
exceptions.ValidationError, |
|
|
exceptions.ValidationError, |
|
@ -39,4 +38,3 @@ class TestPosRequireCustomer(common.TransactionCase): |
|
|
'partner_id': False, |
|
|
'partner_id': False, |
|
|
}) |
|
|
}) |
|
|
) |
|
|
) |
|
|
|
|
|
|