Warning message if the order has no line

bzr revid: olt@tinyerp.com-20090602110223-aw59wyc1b0rvrzhk
This commit is contained in:
Olivier Laurent
2009-06-02 13:02:23 +02:00
parent 3489dbf803
commit 49908a6dd2
2 changed files with 11 additions and 6 deletions
-5
View File
@@ -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'
@@ -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,