Browse Source

Error raised using UserError and changed MVC hierarchy

pull/775/head
Atchuthan, Sodexis 9 years ago
parent
commit
f7e652ca8b
  1. 3
      __init__.py
  2. 8
      __openerp__.py
  3. 0
      data/sale.exception.csv
  4. 0
      data/sale_exception_data.xml
  5. 5
      models/__init__.py
  6. 7
      models/sale.py
  7. 0
      views/sale_view.xml

3
__init__.py

@ -2,5 +2,4 @@
# © 2011 Raphaël Valyi, Renato Lima, Guewen Baconnier, Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import sale
from . import wizard
from . import wizard, models

8
__openerp__.py

@ -9,12 +9,14 @@
'author': "Akretion, Sodexis, Odoo Community Association (OCA)",
'website': 'http://www.akretion.com',
'depends': ['sale'],
'license': 'AGPL-3',
'data': [
'security/ir.model.access.csv',
'wizard/sale_exception_confirm_view.xml',
'settings/sale.exception.csv',
'sale_exception_data.xml',
'sale_view.xml',
'data/sale.exception.csv',
'data/sale_exception_data.xml',
'views/sale_view.xml',
],
'images': [],
'installable': True,
}

0
settings/sale.exception.csv → data/sale.exception.csv

0
sale_exception_data.xml → data/sale_exception_data.xml

5
models/__init__.py

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2011 Raphaël Valyi, Renato Lima, Guewen Baconnier, Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import sale

7
sale.py → models/sale.py

@ -4,10 +4,9 @@
import time
from openerp import api, models, fields
from openerp.exceptions import Warning
from openerp import api, models, fields, _
from openerp.exceptions import UserError
from openerp.tools.safe_eval import safe_eval
from openerp.tools.translate import _
class SaleException(models.Model):
@ -163,7 +162,7 @@ class SaleOrder(models.Model):
mode='exec',
nocopy=True) # nocopy allows to return 'result'
except Exception, e:
raise Warning(
raise UserError(
_('Error when evaluating the sale exception '
'rule:\n %s \n(%s)') % (rule.name, e))
return space.get('failed', False)

0
sale_view.xml → views/sale_view.xml

Loading…
Cancel
Save