diff options
| author | Olivier Laurent <olt@tinyerp.com> | 2009-06-02 13:02:23 +0200 |
|---|---|---|
| committer | Olivier Laurent <olt@tinyerp.com> | 2009-06-02 13:02:23 +0200 |
| commit | 49908a6dd2b52efb60cd8a6aebe1cbb3fc42661b (patch) | |
| tree | 89726554d1282ce1cdb44ecf95127a62cb4b754a | |
| parent | 3489dbf80387afb800a357b67d592c80485e38e9 (diff) | |
Warning message if the order has no line
bzr revid: olt@tinyerp.com-20090602110223-aw59wyc1b0rvrzhk
| -rw-r--r-- | addons/point_of_sale/pos.py | 5 | ||||
| -rw-r--r-- | addons/point_of_sale/wizard/wizard_pos_payment.py | 12 |
2 files changed, 11 insertions, 6 deletions
diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index 25fec4a5e89..004f89d69a3 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -28,11 +28,6 @@ from tools.translate import _ import tools from wizard import except_wizard -# XXX -""" -erreur si pos sans lignes -""" - class pos_config_journal(osv.osv): _name = 'pos.config.journal' diff --git a/addons/point_of_sale/wizard/wizard_pos_payment.py b/addons/point_of_sale/wizard/wizard_pos_payment.py index 8e7c95d86d2..285433d1f15 100644 --- a/addons/point_of_sale/wizard/wizard_pos_payment.py +++ b/addons/point_of_sale/wizard/wizard_pos_payment.py @@ -150,6 +150,16 @@ def _check(self, cr, uid, data, context): return action +def _test_no_line(self, cr, uid, data, context): + pool = pooler.get_pool(cr.dbname) + order = pool.get('pos.order').browse(cr, uid, data['id'], context) + + if not order.lines: + raise wizard.except_wizard(_('Error'), _('No order lines defined for this sale.')) + + return {} + + def create_invoice(self, cr, uid, data, context): wf_service = netsvc.LocalService("workflow") for i in data['ids']: @@ -161,7 +171,7 @@ def create_invoice(self, cr, uid, data, context): class pos_payment(wizard.interface): states = { 'init': { - 'actions': [], + 'actions': [_test_no_line], 'result': { 'type': 'choice', 'next_state': _check, |
