From 99a72c7792f38c7a337c5eefd5f93aa7d512b2c6 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 18 Sep 2011 15:41:16 +0200 Subject: [PATCH] [Useability] improved error message bzr revid: fp@tinyerp.com-20110918134116-2vvdelak2268j6pz --- addons/account/account.py | 36 +++++++++---------- addons/account/account_bank_statement.py | 2 +- addons/account/invoice.py | 8 ++--- addons/account_voucher/account_voucher.py | 2 +- addons/anonymization/anonymization.py | 2 +- .../hr_timesheet_sheet/hr_timesheet_sheet.py | 24 ++++++------- addons/mrp/mrp.py | 4 +-- addons/mrp_operations/mrp_operations.py | 16 ++++----- addons/project_timesheet/project_timesheet.py | 2 +- addons/purchase/purchase.py | 12 +++---- addons/sale/sale.py | 7 ++-- addons/stock_planning/stock_planning.py | 2 +- 12 files changed, 59 insertions(+), 58 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 093583d1bd7..1412cc9b61f 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -439,8 +439,8 @@ class account_account(osv.osv): _constraints = [ (_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id']), - (_check_type, 'Configuration Error! \nYou cannot define children to an account with internal type different of "View"! ', ['type']), - (_check_account_type, 'Configuration Error! \nYou cannot select an account type with a deferral method different of "Unreconciled" for accounts with internal type "Payable/Receivable"! ', ['user_type','type']), + (_check_type, 'Configuration Error! \nYou can not define children to an account with internal type different of "View"! ', ['type']), + (_check_account_type, 'Configuration Error! \nYou can not select an account type with a deferral method different of "Unreconciled" for accounts with internal type "Payable/Receivable"! ', ['user_type','type']), ] _sql_constraints = [ ('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !') @@ -516,14 +516,14 @@ class account_account(osv.osv): if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]): if method == 'write': - raise osv.except_osv(_('Error !'), _('You cannot deactivate an account that contains account moves.')) + raise osv.except_osv(_('Error !'), _('You can not desactivate an account that contains some journal items.')) elif method == 'unlink': - raise osv.except_osv(_('Error !'), _('You cannot remove an account which has account entries!. ')) + raise osv.except_osv(_('Error !'), _('You can not remove an account containing journal items!. ')) #Checking whether the account is set as a property to any Partner or not value = 'account.account,' + str(ids[0]) partner_prop_acc = self.pool.get('ir.property').search(cr, uid, [('value_reference','=',value)], context=context) if partner_prop_acc: - raise osv.except_osv(_('Warning !'), _('You cannot remove/deactivate an account which is set as a property to any Partner.')) + raise osv.except_osv(_('Warning !'), _('You can not remove/desactivate an account which is set on a customer or supplier.')) return True def _check_allow_type_change(self, cr, uid, ids, new_type, context=None): @@ -536,10 +536,10 @@ class account_account(osv.osv): if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]): #Check for 'Closed' type if old_type == 'closed' and new_type !='closed': - raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from 'Closed' to any other type which contains account entries!")) + raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from 'Closed' to any other type which contains journal items!")) #Check for change From group1 to group2 and vice versa if (old_type in group1 and new_type in group2) or (old_type in group2 and new_type in group1): - raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from '%s' to '%s' type as it contains account entries!") % (old_type,new_type,)) + raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from '%s' to '%s' type as it contains journal items!") % (old_type,new_type,)) return True def write(self, cr, uid, ids, vals, context=None): @@ -668,7 +668,7 @@ class account_journal(osv.osv): if 'company_id' in vals and journal.company_id.id != vals['company_id']: move_lines = self.pool.get('account.move.line').search(cr, uid, [('journal_id', 'in', ids)]) if move_lines: - raise osv.except_osv(_('Warning !'), _('You cannot modify company of this journal as its related record exist in Entry Lines')) + raise osv.except_osv(_('Warning !'), _('You can not modify the company of this journal as its related record exist in journal items')) return super(account_journal, self).write(cr, uid, ids, vals, context=context) def create_sequence(self, cr, uid, vals, context=None): @@ -814,8 +814,8 @@ class account_fiscalyear(osv.osv): return True _constraints = [ - (_check_duration, 'Error! The duration of the Fiscal Year is invalid. ', ['date_stop']), - (_check_fiscal_year, 'Error! You cannot define overlapping fiscal years',['date_start', 'date_stop']) + (_check_duration, 'Error! The start date of the fiscal year must be before his end date.', ['date_start','date_stop']), + (_check_fiscal_year, 'Error! You can not define overlapping fiscal years for the same company.',['date_start', 'date_stop']) ] def create_period3(self, cr, uid, ids, context=None): @@ -969,7 +969,7 @@ class account_period(osv.osv): if 'company_id' in vals: move_lines = self.pool.get('account.move.line').search(cr, uid, [('period_id', 'in', ids)]) if move_lines: - raise osv.except_osv(_('Warning !'), _('You cannot modify company of this period as its related record exist in Entry Lines')) + raise osv.except_osv(_('Warning !'), _('You can not modify company of this period as some journal items exists.')) return super(account_period, self).write(cr, uid, ids, vals, context=context) def build_ctx_periods(self, cr, uid, period_from_id, period_to_id): @@ -1197,10 +1197,10 @@ class account_move(osv.osv): _constraints = [ (_check_centralisation, - 'You cannot create more than one move per period on centralized journal', + 'You can not create more than one move per period on centralized journal', ['journal_id']), (_check_period_journal, - 'You cannot create entries on different periods/journals in the same move', + 'You can not create journal items on different periods/journals in the same journal entry', ['line_id']), ] @@ -1211,7 +1211,7 @@ class account_move(osv.osv): valid_moves = self.validate(cr, uid, ids, context) if not valid_moves: - raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !')) + raise osv.except_osv(_('Integrity Error !'), _('You can not validate a non-balanced entry !\nMake sure you have configured payment terms properly !\nThe latest payment term line should be of the type "Balance" !')) obj_sequence = self.pool.get('ir.sequence') for move in self.browse(cr, uid, valid_moves, context=context): if move.name =='/': @@ -1247,7 +1247,7 @@ class account_move(osv.osv): if not top: top = account2.id elif top<>account2.id: - raise osv.except_osv(_('Error !'), _('You cannot validate a Journal Entry unless all journal items are in same chart of accounts !')) + raise osv.except_osv(_('Error !'), _('You can not validate a journal entry unless all journal items belongs to the same chart of accounts !')) return self.post(cursor, user, ids, context=context) def button_cancel(self, cr, uid, ids, context=None): @@ -1334,7 +1334,7 @@ class account_move(osv.osv): for move in self.browse(cr, uid, ids, context=context): if move['state'] != 'draft': raise osv.except_osv(_('UserError'), - _('You can not delete posted movement: "%s"!') % \ + _('You can not delete a posted journal entry "%s"!') % \ move['name']) line_ids = map(lambda x: x.id, move.line_id) context['journal_id'] = move.journal_id.id @@ -2389,7 +2389,7 @@ class account_account_template(osv.osv): _check_recursion = check_cycle _constraints = [ (_check_recursion, 'Error ! You can not create recursive account templates.', ['parent_id']), - (_check_type, 'Configuration Error! \nYou cannot define children to an account with internal type different of "View"! ', ['type']), + (_check_type, 'Configuration Error!\nYou can not define children to an account with internal type different of "View"! ', ['type']), ] @@ -2422,7 +2422,7 @@ class account_add_tmpl_wizard(osv.osv_memory): ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]], ['code']) res = None if not ptids or not ptids[0]['code']: - raise osv.except_osv(_('Error !'), _('Cannot locate parent code for template account!')) + raise osv.except_osv(_('Error !'), _('I can not locate a parent code for the template account!')) res = acc_obj.search(cr, uid, [('code','=',ptids[0]['code'])]) return res and res[0] or False diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 85b262ed4a7..277e2aa04b1 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -381,7 +381,7 @@ class account_bank_statement(osv.osv): if t['state'] in ('draft'): unlink_ids.append(t['id']) else: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete bank statement(s) which are already confirmed !')) + raise osv.except_osv(_('Invalid action !'), _('In order to delete a bank statement, you must first cancel it to delete related journal items.')) osv.osv.unlink(self, cr, uid, unlink_ids, context=context) return True diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 44aea3466e6..3747ef978a8 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -375,7 +375,7 @@ class account_invoice(osv.osv): if t['state'] in ('draft', 'cancel') and t['internal_number']== False: unlink_ids.append(t['id']) else: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete invoice(s) that are already opened(or been in opened state ever) or paid!')) + raise osv.except_osv(_('Invalid action !'), _('You can not delete an invoice which is open or paid. We suggest you to refund it instead.')) osv.osv.unlink(self, cr, uid, unlink_ids, context=context) return True @@ -828,7 +828,7 @@ class account_invoice(osv.osv): total_percent += line.value_amount total_fixed = (total_fixed * 100) / (inv.amount_total or 1.0) if (total_fixed + total_percent) > 100: - raise osv.except_osv(_('Error !'), _("Cannot create the invoice !\nThe payment term defined gives a computed amount greater than the total invoiced amount.")) + raise osv.except_osv(_('Error !'), _("Can not create the invoice !\nThe related payment term is probably misconfigured as it gives a computed amount greater than the total invoiced amount.")) # one move line per tax line iml += ait_obj.move_line_get(cr, uid, inv.id) @@ -910,7 +910,7 @@ class account_invoice(osv.osv): journal = self.pool.get('account.journal').browse(cr, uid, journal_id) if journal.centralisation: raise osv.except_osv(_('UserError'), - _('Cannot create invoice move on centralised journal')) + _('You cannot create an invoice on a centralised journal. Uncheck the centralised counterpart box in the related journal from the configuration menu.')) line = self.finalize_invoice_move_lines(cr, uid, inv, line) @@ -1019,7 +1019,7 @@ class account_invoice(osv.osv): pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids']) for move_line in pay_ids: if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids: - raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!')) + raise osv.except_osv(_('Error !'), _('You can not cancel an invoice which is partially paid! You need to unreconcile related payment entries first!')) # First, set the invoices as cancelled and detach the move ids self.write(cr, uid, ids, {'state':'cancel', 'move_id':False}) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 5efe46841c7..a40708388b2 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -707,7 +707,7 @@ class account_voucher(osv.osv): def unlink(self, cr, uid, ids, context=None): for t in self.read(cr, uid, ids, ['state'], context=context): if t['state'] not in ('draft', 'cancel'): - raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !')) + raise osv.except_osv(_('Invalid action !'), _('In order to delete a voucher, you must cancel it!')) return super(account_voucher, self).unlink(cr, uid, ids, context=context) def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'): diff --git a/addons/anonymization/anonymization.py b/addons/anonymization/anonymization.py index c4a2d9f0488..5d1f8a76e1c 100644 --- a/addons/anonymization/anonymization.py +++ b/addons/anonymization/anonymization.py @@ -52,7 +52,7 @@ class ir_model_fields_anonymization(osv.osv): } _sql_constraints = [ - ('model_id_field_id_uniq', 'unique (model_name, field_name)', _("You cannot have two records having the same model and the same field")), + ('model_id_field_id_uniq', 'unique (model_name, field_name)', _("You cannot have two fields with the same name on the same object!")), ] def _get_global_state(self, cr, uid, context=None): diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 4e1eebb5f4c..294f8f09500 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -167,33 +167,33 @@ class hr_timesheet_sheet(osv.osv): ids_signout = self.pool.get('hr.attendance').search(cr,uid,[('sheet_id', '=', sheet_id),('action','=','sign_out')]) if len(ids_signin) != len(ids_signout): - raise osv.except_osv(('Warning !'),_('The timesheet cannot be validated as it does not contain equal no. of sign ins and sign outs!')) + raise osv.except_osv(('Warning !'),_('The timesheet cannot be validated as it does not contain an equal number of sign ins and sign outs!')) return True def copy(self, cr, uid, ids, *args, **argv): - raise osv.except_osv(_('Error !'), _('You cannot duplicate a timesheet !')) + raise osv.except_osv(_('Error !'), _('You cannot duplicate a timesheet!')) def create(self, cr, uid, vals, *args, **argv): if 'employee_id' in vals: if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).user_id: - raise osv.except_osv(_('Error !'), _('You cannot create a timesheet for an employee that does not have any user defined !')) + raise osv.except_osv(_('Error !'), _('In order to create a timesheet for this employee, you must assign it to a user!')) if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).product_id: - raise osv.except_osv(_('Error !'), _('You cannot create a timesheet for an employee that does not have any product defined !')) + raise osv.except_osv(_('Error !'), _('In order to create a timesheet for this employee, you must link the employee to a product, like \'Consultant\'!')) if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).journal_id: - raise osv.except_osv(_('Error !'), _('You cannot create a timesheet for an employee that does not have any analytic journal defined !')) + raise osv.except_osv(_('Error !'), _('In order to create a timesheet for this employee, you must assign the employee to an analytic journal, like \'Timesheet\'!')) return super(hr_timesheet_sheet, self).create(cr, uid, vals, *args, **argv) def write(self, cr, uid, ids, vals, *args, **argv): if 'employee_id' in vals: new_user_id = self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).user_id.id or False if not new_user_id: - raise osv.except_osv(_('Error !'), _('You cannot create a timesheet for an employee that does not have any user defined !')) + raise osv.except_osv(_('Error !'), _('In order to create a timesheet for this employee, you must assign it to a user!')) if not self._sheet_date(cr, uid, ids, forced_user_id=new_user_id): - raise osv.except_osv(_('Error !'), _('You can not have 2 timesheets that overlaps !\nPlease use the menu \'My Current Timesheet\' to avoid this problem.')) + raise osv.except_osv(_('Error !'), _('You can not have 2 timesheets that overlaps!\nYou should use the menu \'My Timesheet\' to avoid this problem.')) if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).product_id: - raise osv.except_osv(_('Error !'), _('You cannot create a timesheet for an employee that does not have any product defined !')) + raise osv.except_osv(_('Error !'), _('In order to create a timesheet for this employee, you must link the employee to a product!')) if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).journal_id: - raise osv.except_osv(_('Error !'), _('You cannot create a timesheet for an employee that does not have any analytic journal defined !')) + raise osv.except_osv(_('Error !'), _('In order to create a timesheet for this employee, you must assign the employee to an analytic journal!')) return super(hr_timesheet_sheet, self).write(cr, uid, ids, vals, *args, **argv) def button_confirm(self, cr, uid, ids, context=None): @@ -377,9 +377,9 @@ class hr_timesheet_sheet(osv.osv): sheets = self.read(cr, uid, ids, ['state','total_attendance'], context=context) for sheet in sheets: if sheet['state'] in ('confirm', 'done'): - raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sheet(s) which are already confirmed !')) + raise osv.except_osv(_('Invalid action !'), _('You cannot delete a timesheet which is already confirmed!')) elif sheet['total_attendance'] <> 0.00: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sheet(s) which have attendance entries encoded !')) + raise osv.except_osv(_('Invalid action !'), _('You cannot delete a timesheet which have attendance entries!')) return super(hr_timesheet_sheet, self).unlink(cr, uid, ids, context=context) hr_timesheet_sheet() @@ -612,7 +612,7 @@ class hr_attendance(osv.osv): if 'sheet_id' in context: ts = self.pool.get('hr_timesheet_sheet.sheet').browse(cr, uid, context['sheet_id'], context=context) if ts.state not in ('draft', 'new'): - raise osv.except_osv(_('Error !'), _('You cannot modify an entry in a confirmed timesheet !')) + raise osv.except_osv(_('Error !'), _('You cannot modify an entry in a confirmed timesheet!')) res = super(hr_attendance,self).create(cr, uid, vals, context=context) if 'sheet_id' in context: if context['sheet_id'] != self.browse(cr, uid, res, context=context).sheet_id.id: diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 1c8d03a747c..c57cde2a533 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -502,7 +502,7 @@ class mrp_production(osv.osv): return True _constraints = [ - (_check_qty, 'Order quantity cannot be negative or zero !', ['product_qty']), + (_check_qty, 'Order quantity cannot be negative or zero!', ['product_qty']), ] def unlink(self, cr, uid, ids, context=None): @@ -512,7 +512,7 @@ class mrp_production(osv.osv): if s['state'] in ['draft','cancel']: unlink_ids.append(s['id']) else: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete Production Order(s) which are in %s State!') % s['state']) + raise osv.except_osv(_('Invalid action !'), _('Cannot delete a manufacturing order in the state \'%s\'!') % s['state']) return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) def copy(self, cr, uid, id, default=None, context=None): diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index fe926d30ac1..4e665b3f9dc 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -131,7 +131,7 @@ class mrp_production_workcenter_line(osv.osv): elif prod_obj.state =='in_production': return else: - raise osv.except_osv(_('Error!'),_('Production Order Cannot start in [%s] state') % (prod_obj.state,)) + raise osv.except_osv(_('Error!'),_('Manufacturing order cannot start in state "%s"!') % (prod_obj.state,)) else: oper_ids = self.search(cr,uid,[('production_id','=',prod_obj.id)]) obj = self.browse(cr,uid,oper_ids) @@ -458,30 +458,30 @@ class mrp_operations_operation(osv.osv): code_lst.append(oper.code_id.start_stop) if code.start_stop=='start': if 'start' in code_lst: - raise osv.except_osv(_('Sorry!'),_('Operation has already started !' 'You can either Pause /Finish/Cancel the operation')) + raise osv.except_osv(_('Sorry!'),_('Operation has already started !' 'Youcan either Pause/Finish/Cancel the operation')) return False if code.start_stop=='pause': if code_lst[len(code_lst)-1]!='resume' and code_lst[len(code_lst)-1]!='start': - raise osv.except_osv(_('Error!'),_('You cannot Pause the Operation other then Start/Resume state !')) + raise osv.except_osv(_('Error!'),_('In order to Pause the operation, it must be in the Start or Resume state!')) return False if code.start_stop=='resume': if code_lst[len(code_lst)-1]!='pause': - raise osv.except_osv(_('Error!'),_(' You cannot Resume the operation other then Pause state !')) + raise osv.except_osv(_('Error!'),_('In order to Resume the operation, it must be in the Pause state!')) return False if code.start_stop=='done': if code_lst[len(code_lst)-1]!='start' and code_lst[len(code_lst)-1]!='resume': - raise osv.except_osv(_('Sorry!'),_('You cannot finish the operation without Starting/Resuming it !')) + raise osv.except_osv(_('Sorry!'),_('In order to Finish the operation, it must be in the Start or Resume state!')) return False if 'cancel' in code_lst: - raise osv.except_osv(_('Sorry!'),_('Operation is Already Cancelled !')) + raise osv.except_osv(_('Sorry!'),_('Operation is Already Cancelled!')) return False if code.start_stop=='cancel': if not 'start' in code_lst : - raise osv.except_osv(_('Error!'),_('There is no Operation to be cancelled !')) + raise osv.except_osv(_('Error!'),_('There is no Operation to be cancelled!')) return False if 'done' in code_lst: - raise osv.except_osv(_('Error!'),_('Operation is already finished !')) + raise osv.except_osv(_('Error!'),_('Operation is already finished!')) return False return True diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index ee506697677..175910a667e 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -228,7 +228,7 @@ class res_partner(osv.osv): def unlink(self, cursor, user, ids, context=None): parnter_id=self.pool.get('project.project').search(cursor, user, [('partner_id', 'in', ids)]) if parnter_id: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete Partner which is Assigned to project !')) + raise osv.except_osv(_('Invalid action !'), _('You can not delete a partner which is assigned to project, we suggest you to uncheck the active box!')) return super(res_partner,self).unlink(cursor, user, ids, context=context) res_partner() diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index b8800d1d53b..b9a288f042e 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -241,7 +241,7 @@ class purchase_order(osv.osv): if s['state'] in ['draft','cancel']: unlink_ids.append(s['id']) else: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!') % _(dict(purchase_order.STATE_SELECTION).get(s['state']))) + raise osv.except_osv(_('Invalid action !'), _('In order to delete a purchase order, it must be cancelled first! ') % _(dict(purchase_order.STATE_SELECTION).get(s['state']))) # TODO: temporary fix in 5.0, to remove in 5.2 when subflows support # automatically sending subflow.delete upon deletion @@ -406,16 +406,16 @@ class purchase_order(osv.osv): for pick in purchase.picking_ids: if pick.state not in ('draft','cancel'): raise osv.except_osv( - _('Could not cancel purchase order !'), - _('You must first cancel all picking attached to this purchase order.')) + _('Unable to cancel this purchase order!'), + _('You must first cancel all receptions related to this purchase order.')) for pick in purchase.picking_ids: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr) for inv in purchase.invoice_ids: if inv and inv.state not in ('cancel','draft'): raise osv.except_osv( - _('Could not cancel this purchase order !'), - _('You must first cancel all invoices attached to this purchase order.')) + _('Unable to cancel this purchase order!'), + _('You must first cancel all invoices related to this purchase order.')) if inv: wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) @@ -707,7 +707,7 @@ class purchase_order_line(osv.osv): temp_qty = s.min_qty # supplier _qty assigned to temp if qty < temp_qty: # If the supplier quantity is greater than entered from user, set minimal. qty = temp_qty - res.update({'warning': {'title': _('Warning'), 'message': _('The selected supplier has a minimal quantity set to %s, you cannot purchase less.') % qty}}) + res.update({'warning': {'title': _('Warning'), 'message': _('The selected supplier has a minimal quantity set to %s, you should not purchase less.') % qty}}) qty_in_product_uom = product_uom_pool._compute_qty(cr, uid, uom, qty, to_uom_id=prod.uom_id.id) price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], product, qty_in_product_uom or 1.0, partner_id, { diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 3e8e2cfd9f7..9c585801ffa 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -291,7 +291,8 @@ class sale_order(osv.osv): if s['state'] in ['draft', 'cancel']: unlink_ids.append(s['id']) else: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sales Order(s) which are already confirmed !')) + raise osv.except_osv(_('Invalid action !'), _('In order to delete a confirmed sale order, you must cancel it before ! To cancel a sale order, you must first cancel related picking or delivery orders.')) + return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) def onchange_shop_id(self, cr, uid, ids, shop_id): @@ -977,7 +978,7 @@ class sale_order_line(osv.osv): def button_cancel(self, cr, uid, ids, context=None): for line in self.browse(cr, uid, ids, context=context): if line.invoiced: - raise osv.except_osv(_('Invalid action !'), _('You cannot cancel a sales order line that has already been invoiced !')) + raise osv.except_osv(_('Invalid action !'), _('You cannot cancel a sale order line that has already been invoiced!')) for move_line in line.move_ids: if move_line.state != 'cancel': raise osv.except_osv( @@ -1178,7 +1179,7 @@ class sale_order_line(osv.osv): """Allows to delete sales order lines in draft,cancel states""" for rec in self.browse(cr, uid, ids, context=context): if rec.state not in ['draft', 'cancel']: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete a sales order line which is %s !') %(rec.state,)) + raise osv.except_osv(_('Invalid action !'), _('Cannot delete a sales order line which is in state \'%s\'!') %(rec.state,)) return super(sale_order_line, self).unlink(cr, uid, ids, context=context) sale_order_line() diff --git a/addons/stock_planning/stock_planning.py b/addons/stock_planning/stock_planning.py index 0fe88664cfb..fe0b2f8f3ce 100644 --- a/addons/stock_planning/stock_planning.py +++ b/addons/stock_planning/stock_planning.py @@ -142,7 +142,7 @@ class stock_sale_forecast(osv.osv): if t['state'] in ('draft'): unlink_ids.append(t['id']) else: - raise osv.except_osv(_('Invalid action !'), _('Cannot delete Validated Sale Forecasts !')) + raise osv.except_osv(_('Invalid action !'), _('Cannot delete a validated sales forecast!')) osv.osv.unlink(self, cr, uid, unlink_ids, context=context) return True