[FIX] *: replace uses of except_osv with UserError that have been forgotten during previous forward-ports
This commit is contained in:
@@ -306,7 +306,7 @@ class MergePartnerAutomatic(osv.TransientModel):
|
||||
for partner_id in partner_ids:
|
||||
child_ids = child_ids.union(set(proxy.search(cr, uid, [('id', 'child_of', [partner_id])])) - set([partner_id]))
|
||||
if set(partner_ids).intersection(child_ids):
|
||||
raise osv.except_osv(_('Error'), _("You cannot merge a contact with one of his parent."))
|
||||
raise UserError(_("You cannot merge a contact with one of his parent."))
|
||||
|
||||
if openerp.SUPERUSER_ID != uid and len(set(partner.email for partner in proxy.browse(cr, uid, partner_ids, context=context))) > 1:
|
||||
raise UserError(_("All contacts must have the same email. Only the Administrator can merge contacts with different emails."))
|
||||
|
||||
@@ -1546,7 +1546,7 @@ class product_template(osv.osv):
|
||||
product_ctx = dict(context or {}, active_test=False)
|
||||
if self.search_count(cr, uid, [('id', 'in', ids), ('available_in_pos', '=', True)], context=product_ctx):
|
||||
if self.pool['pos.session'].search_count(cr, uid, [('state', '!=', 'closed')], context=context):
|
||||
raise osv.except_osv(_('Error!'),
|
||||
raise UserError(
|
||||
_('You cannot delete a product saleable in point of sale while a session is still opened.'))
|
||||
return super(product_template, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ class purchase_order(osv.osv):
|
||||
|
||||
company_id = context.get('company_id') or self.pool.get('res.users')._get_company(cr, uid, context=context)
|
||||
if not company_id:
|
||||
raise osv.except_osv(_('Error!'), _('There is no default company for the current user!'))
|
||||
raise UserError(_('There is no default company for the current user!'))
|
||||
fp = self.pool['account.fiscal.position'].get_fiscal_position(cr, uid, company_id, partner_id, context=context)
|
||||
supplier_address = partner.address_get(cr, uid, [partner_id], ['default'], context=context)
|
||||
supplier = partner.browse(cr, uid, partner_id, context=context)
|
||||
@@ -578,8 +578,7 @@ class purchase_order(osv.osv):
|
||||
if not any(line.state != 'cancel' for line in po.order_line):
|
||||
raise UserError(_('You cannot confirm a purchase order without any purchase order line.'))
|
||||
if po.invoice_method == 'picking' and not any([l.product_id and l.product_id.type in ('product', 'consu') and l.state != 'cancel' for l in po.order_line]):
|
||||
raise osv.except_osv(
|
||||
_('Error!'),
|
||||
raise UserError(
|
||||
_("You cannot confirm a purchase order with Invoice Control Method 'Based on incoming shipments' that doesn't contain any stockable item."))
|
||||
for line in po.order_line:
|
||||
if line.state=='draft':
|
||||
|
||||
@@ -375,7 +375,7 @@ class sale_order_line(osv.osv):
|
||||
for procurement in lines.mapped('procurement_ids'):
|
||||
for move in procurement.move_ids:
|
||||
if move.state == 'done' and not move.scrapped:
|
||||
raise osv.except_osv(_('Invalid Action!'), _('You cannot cancel a sale order line which is linked to a stock move already done.'))
|
||||
raise UserError(_('You cannot cancel a sale order line which is linked to a stock move already done.'))
|
||||
return super(sale_order_line, self).button_cancel(cr, uid, ids, context=context)
|
||||
|
||||
class stock_move(osv.osv):
|
||||
|
||||
@@ -60,7 +60,7 @@ class stock_return_picking(osv.osv_memory):
|
||||
context = {}
|
||||
if context and context.get('active_ids', False):
|
||||
if len(context.get('active_ids')) > 1:
|
||||
raise osv.except_osv(_('Warning!'), _("You may only return one picking at a time!"))
|
||||
raise UserError(_("You may only return one picking at a time!"))
|
||||
res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context)
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
|
||||
@@ -134,7 +134,7 @@ class product_template(osv.osv):
|
||||
if not counterpart_account:
|
||||
counterpart_account = product.categ_id.property_account_expense_categ and product.categ_id.property_account_expense_categ.id or False
|
||||
if not counterpart_account:
|
||||
raise osv.except_osv(_('Error!'), _('No expense account defined on the product %s or on its category') % (product.name))
|
||||
raise UserError(_('No expense account defined on the product %s or on its category') % (product.name))
|
||||
if diff * qty > 0:
|
||||
amount_diff = qty * diff
|
||||
debit_account_id = counterpart_account
|
||||
|
||||
@@ -196,7 +196,7 @@ class stock_quant(osv.osv):
|
||||
|
||||
:param context: context dictionary that can explicitly mention the company to consider via the 'force_company' key
|
||||
:returns: journal_id, source account, destination account, valuation account
|
||||
:raise: osv.except_osv() is any mandatory account or journal is not defined.
|
||||
:raise: openerp.exceptions.UserError if any mandatory account or journal is not defined.
|
||||
"""
|
||||
product_obj = self.pool.get('product.template')
|
||||
accounts = product_obj.get_product_accounts(cr, uid, move.product_id.product_tmpl_id.id, context)
|
||||
|
||||
@@ -527,7 +527,7 @@ class res_users(osv.osv):
|
||||
|
||||
:return: True
|
||||
:raise: openerp.exceptions.AccessDenied when old password is wrong
|
||||
:raise: except_osv when new password is not set or empty
|
||||
:raise: openerp.exceptions.UserError when new password is not set or empty
|
||||
"""
|
||||
self.check(cr.dbname, uid, old_passwd)
|
||||
if new_passwd:
|
||||
|
||||
Reference in New Issue
Block a user