[IMP] all: Improve error messages
Many error messages are misleading or too "vague" This task aims to improve all error message. Task #47042 PR #23321
This commit is contained in:
committed by
Yannick Tivisse
parent
c9735c75d6
commit
6383120f3b
@@ -123,7 +123,7 @@ class AccountAccount(models.Model):
|
||||
opening_move = self.company_id.account_opening_move_id
|
||||
|
||||
if not opening_move:
|
||||
raise UserError(_("No opening move defined !"))
|
||||
raise UserError(_("You must first define an opening move."))
|
||||
|
||||
if opening_move.state == 'draft':
|
||||
# check whether we should create a new move line or modify an existing one
|
||||
@@ -262,7 +262,7 @@ class AccountAccount(models.Model):
|
||||
('matched_credit_ids', '!=', False),
|
||||
])
|
||||
if partial_lines_count > 0:
|
||||
raise UserError(_('You cannot switch an account to not allow the reconciliation'
|
||||
raise UserError(_('You cannot switch an account to prevent the reconciliation '
|
||||
'if some partial reconciliations are still pending.'))
|
||||
query = """
|
||||
UPDATE account_move_line
|
||||
@@ -289,7 +289,7 @@ class AccountAccount(models.Model):
|
||||
@api.multi
|
||||
def unlink(self):
|
||||
if self.env['account.move.line'].search([('account_id', 'in', self.ids)], limit=1):
|
||||
raise UserError(_('You cannot do that on an account that contains journal items.'))
|
||||
raise UserError(_('You cannot perform this action on an account that contains journal items.'))
|
||||
#Checking whether the account is set as a property to any Partner or not
|
||||
values = ['account.account,%s' % (account_id,) for account_id in self.ids]
|
||||
partner_prop_acc = self.env['ir.property'].search([('value_reference', 'in', values)], limit=1)
|
||||
@@ -485,9 +485,9 @@ class AccountJournal(models.Model):
|
||||
def _check_currency(self):
|
||||
if self.currency_id:
|
||||
if self.default_credit_account_id and not self.default_credit_account_id.currency_id.id == self.currency_id.id:
|
||||
raise ValidationError(_('Configuration error!\nThe currency of the journal should be the same than the default credit account.'))
|
||||
raise ValidationError(_('The currency of the journal should be the same than the default credit account.'))
|
||||
if self.default_debit_account_id and not self.default_debit_account_id.currency_id.id == self.currency_id.id:
|
||||
raise ValidationError(_('Configuration error!\nThe currency of the journal should be the same than the default debit account.'))
|
||||
raise ValidationError(_('The currency of the journal should be the same than the default debit account.'))
|
||||
|
||||
@api.one
|
||||
@api.constrains('type', 'bank_account_id')
|
||||
@@ -759,7 +759,7 @@ class ResPartnerBank(models.Model):
|
||||
@api.constrains('journal_id')
|
||||
def _check_journal_id(self):
|
||||
if len(self.journal_id) > 1:
|
||||
raise ValidationError(_('A bank account can only belong to one journal.'))
|
||||
raise ValidationError(_('A bank account can belong to only one journal.'))
|
||||
|
||||
|
||||
#----------------------------------------------------------
|
||||
@@ -836,7 +836,7 @@ class AccountTax(models.Model):
|
||||
if not self._check_m2m_recursion('children_tax_ids'):
|
||||
raise ValidationError(_("Recursion found for tax '%s'.") % (self.name,))
|
||||
if not all(child.type_tax_use in ('none', self.type_tax_use) for child in self.children_tax_ids):
|
||||
raise ValidationError(_('The application scope of taxes in a group must be either the same as the group or "None".'))
|
||||
raise ValidationError(_('The application scope of taxes in a group must be either the same as the group or left empty.'))
|
||||
|
||||
@api.multi
|
||||
@api.returns('self', lambda value: value.id)
|
||||
|
||||
@@ -316,7 +316,7 @@ class AccountBankStatementLine(models.Model):
|
||||
# Allow to enter bank statement line with an amount of 0,
|
||||
# so that user can enter/import the exact bank statement they have received from their bank in Odoo
|
||||
if self.journal_id.type != 'bank' and self.currency_id.is_zero(self.amount):
|
||||
raise ValidationError(_('A Cash transaction can\'t have a 0 amount.'))
|
||||
raise ValidationError(_('The amount of a cash transaction cannot be 0.'))
|
||||
|
||||
@api.one
|
||||
@api.constrains('amount', 'amount_currency')
|
||||
|
||||
@@ -480,7 +480,7 @@ class AccountInvoice(models.Model):
|
||||
if field not in vals and invoice[field]:
|
||||
vals[field] = invoice._fields[field].convert_to_write(invoice[field], invoice)
|
||||
if not vals.get('account_id',False):
|
||||
raise UserError(_('Configuration error!\nCould not find any account to create the invoice, are you sure you have a chart of account installed?'))
|
||||
raise UserError(_('No account was found to create the invoice, be sure you have installed a chart of account.'))
|
||||
|
||||
invoice = super(AccountInvoice, self.with_context(mail_create_nolog=True)).create(vals)
|
||||
|
||||
@@ -1574,7 +1574,7 @@ class AccountInvoiceLine(models.Model):
|
||||
if not part:
|
||||
warning = {
|
||||
'title': _('Warning!'),
|
||||
'message': _('You must first select a partner!'),
|
||||
'message': _('You must first select a partner.'),
|
||||
}
|
||||
return {'warning': warning}
|
||||
|
||||
@@ -1640,7 +1640,7 @@ class AccountInvoiceLine(models.Model):
|
||||
if self.product_id.uom_id.category_id.id != self.uom_id.category_id.id:
|
||||
warning = {
|
||||
'title': _('Warning!'),
|
||||
'message': _('The selected unit of measure is not compatible with the unit of measure of the product.'),
|
||||
'message': _('The selected unit of measure has to be in the same category as the product unit of measure.'),
|
||||
}
|
||||
self.uom_id = self.product_id.uom_id.id
|
||||
if warning:
|
||||
@@ -1746,10 +1746,10 @@ class AccountPaymentTerm(models.Model):
|
||||
def _check_lines(self):
|
||||
payment_term_lines = self.line_ids.sorted()
|
||||
if payment_term_lines and payment_term_lines[-1].value != 'balance':
|
||||
raise ValidationError(_('A Payment Terms should have its last line of type Balance.'))
|
||||
raise ValidationError(_('The last line of a Payment Term should have the Balance type.'))
|
||||
lines = self.line_ids.filtered(lambda r: r.value == 'balance')
|
||||
if len(lines) > 1:
|
||||
raise ValidationError(_('A Payment Terms should have only one line of type Balance.'))
|
||||
raise ValidationError(_('A Payment Term should have only one line of type Balance.'))
|
||||
|
||||
@api.one
|
||||
def compute(self, value, date_ref=False):
|
||||
@@ -1829,7 +1829,7 @@ class AccountPaymentTermLine(models.Model):
|
||||
@api.constrains('value', 'value_amount')
|
||||
def _check_percent(self):
|
||||
if self.value == 'percent' and (self.value_amount < 0.0 or self.value_amount > 100.0):
|
||||
raise ValidationError(_('Percentages for Payment Terms Line must be between 0 and 100.'))
|
||||
raise ValidationError(_('Percentages on the Payment Terms lines must be between 0 and 100.'))
|
||||
|
||||
@api.one
|
||||
@api.constrains('days')
|
||||
|
||||
@@ -520,7 +520,7 @@ class AccountMoveLine(models.Model):
|
||||
def _check_currency_and_amount(self):
|
||||
for line in self:
|
||||
if (line.amount_currency and not line.currency_id):
|
||||
raise ValidationError(_("You cannot create journal items with a secondary currency without filling both 'currency' and 'amount currency' field."))
|
||||
raise ValidationError(_("You cannot create journal items with a secondary currency without filling both 'currency' and 'amount currency' fields."))
|
||||
|
||||
@api.multi
|
||||
@api.constrains('amount_currency', 'debit', 'credit')
|
||||
@@ -739,15 +739,15 @@ class AccountMoveLine(models.Model):
|
||||
if (line.account_id.internal_type in ('receivable', 'payable')):
|
||||
partners.add(line.partner_id.id)
|
||||
if line.reconciled:
|
||||
raise UserError(_('You are trying to reconcile some entries that are already reconciled!'))
|
||||
raise UserError(_('You are trying to reconcile some entries that are already reconciled.'))
|
||||
if len(company_ids) > 1:
|
||||
raise UserError(_('To reconcile the entries company should be the same for all entries!'))
|
||||
raise UserError(_('To reconcile the entries company should be the same for all entries.'))
|
||||
if len(set(all_accounts)) > 1:
|
||||
raise UserError(_('Entries are not of the same account!'))
|
||||
raise UserError(_('Entries are not from the same account.'))
|
||||
if not (all_accounts[0].reconcile or all_accounts[0].internal_type == 'liquidity'):
|
||||
raise UserError(_('Account %s (%s) does not allow reconciliation. First change the configuration of this account to allow it.') % (all_accounts[0].name, all_accounts[0].code))
|
||||
if len(partners) > 1:
|
||||
raise UserError(_('The partner has to be the same on all lines for receivable and payable accounts!'))
|
||||
raise UserError(_('The partner has to be the same on all lines for receivable and payable accounts.'))
|
||||
|
||||
#reconcile everything that can be
|
||||
remaining_moves = self.auto_reconcile_lines()
|
||||
@@ -891,7 +891,7 @@ class AccountMoveLine(models.Model):
|
||||
move = self.env['account.move'].browse(vals['move_id'])
|
||||
account = self.env['account.account'].browse(vals['account_id'])
|
||||
if account.deprecated:
|
||||
raise UserError(_('The account %s (%s) is deprecated !') %(account.name, account.code))
|
||||
raise UserError(_('The account %s (%s) is deprecated.') %(account.name, account.code))
|
||||
journal = vals.get('journal_id') and self.env['account.journal'].browse(vals['journal_id']) or move.journal_id
|
||||
vals['date_maturity'] = vals.get('date_maturity') or vals.get('date') or move.date
|
||||
ok = not (journal.type_control_ids or journal.account_control_ids)
|
||||
@@ -951,7 +951,7 @@ class AccountMoveLine(models.Model):
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
if ('account_id' in vals) and self.env['account.account'].browse(vals['account_id']).deprecated:
|
||||
raise UserError(_('You cannot use deprecated account.'))
|
||||
raise UserError(_('You cannot use a deprecated account.'))
|
||||
if any(key in vals for key in ('account_id', 'journal_id', 'date', 'move_id', 'debit', 'credit')):
|
||||
self._update_check()
|
||||
if not self._context.get('allow_amount_currency') and any(key in vals for key in ('amount_currency', 'currency_id')):
|
||||
|
||||
@@ -485,7 +485,7 @@ class account_payment(models.Model):
|
||||
@api.multi
|
||||
def unlink(self):
|
||||
if any(bool(rec.move_line_ids) for rec in self):
|
||||
raise UserError(_("You can not delete a payment that is already posted"))
|
||||
raise UserError(_("You cannot delete a payment that is already posted."))
|
||||
if any(rec.move_name for rec in self):
|
||||
raise UserError(_('It is not allowed to delete a payment that already created a journal entry since it would create a gap in the numbering. You should create the journal entry again and cancel it thanks to a regular revert.'))
|
||||
return super(account_payment, self).unlink()
|
||||
@@ -638,9 +638,9 @@ class account_payment(models.Model):
|
||||
"""
|
||||
journal = journal or self.journal_id
|
||||
if not journal.sequence_id:
|
||||
raise UserError(_('Configuration Error !\nThe journal %s does not have a sequence, please specify one.') % journal.name)
|
||||
raise UserError(_('The journal %s does not have a sequence, please specify one.') % journal.name)
|
||||
if not journal.sequence_id.active:
|
||||
raise UserError(_('Configuration Error !\nThe sequence of journal %s is deactivated.') % journal.name)
|
||||
raise UserError(_('The sequence of journal %s is deactivated.') % journal.name)
|
||||
name = self.move_name or journal.with_context(ir_sequence_date=self.payment_date).sequence_id.next_by_id()
|
||||
return {
|
||||
'name': name,
|
||||
|
||||
@@ -865,7 +865,7 @@ class WizardMultiChartsAccounts(models.TransientModel):
|
||||
# we tolerate switching from accounting package (localization module) as long as there isn't yet any accounting
|
||||
# entries created for the company.
|
||||
if self.existing_accounting(self.company_id):
|
||||
raise UserError(_('Could not install new chart of account as there are already accounting entries existing'))
|
||||
raise UserError(_('Could not install new chart of account as there are already accounting entries existing.'))
|
||||
|
||||
# delete accounting properties
|
||||
prop_values = ['account.account,%s' % (account_id,) for account_id in existing_accounts.ids]
|
||||
|
||||
@@ -48,7 +48,7 @@ class ProductTemplate(models.Model):
|
||||
if dict(self._cr.fetchall()) != uoms:
|
||||
products = self.env['product.product'].search([('product_tmpl_id', 'in', self.ids)])
|
||||
if self.env['account.move.line'].search_count([('product_id', 'in', products.ids)]):
|
||||
raise UserError(_('You can not change the unit of measure of a product that has been already used in an account journal item. If you need to change the unit of measure, you may deactivate this product.'))
|
||||
raise UserError(_('You can not change the unit of measure of a product that has been already used in an account journal item. If you need to change the unit of measure, you should archive this product and create a new one.'))
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -18,6 +18,6 @@ class AccountReportGeneralLedger(models.TransientModel):
|
||||
data = self.pre_print_report(data)
|
||||
data['form'].update(self.read(['initial_balance', 'sortby'])[0])
|
||||
if data['form'].get('initial_balance') and not data['form'].get('date_from'):
|
||||
raise UserError(_("You must define a Start Date"))
|
||||
raise UserError(_("You must define a start Date"))
|
||||
records = self.env[data['model']].browse(data.get('ids', []))
|
||||
return self.env.ref('account.action_report_general_ledger').with_context(landscape=True).report_action(records, data=data)
|
||||
|
||||
@@ -46,7 +46,7 @@ class CashBoxIn(CashBox):
|
||||
@api.multi
|
||||
def _calculate_values_for_statement_line(self, record):
|
||||
if not record.journal_id.company_id.transfer_account_id:
|
||||
raise UserError(_("You should have defined an 'Internal Transfer Account' in your cash register's journal!"))
|
||||
raise UserError(_("You have to define an 'Internal Transfer Account' in your cash register's journal."))
|
||||
return {
|
||||
'date': record.date,
|
||||
'statement_id': record.id,
|
||||
@@ -64,7 +64,7 @@ class CashBoxOut(CashBox):
|
||||
@api.multi
|
||||
def _calculate_values_for_statement_line(self, record):
|
||||
if not record.journal_id.company_id.transfer_account_id:
|
||||
raise UserError(_("You should have defined an 'Internal Transfer Account' in your cash register's journal!"))
|
||||
raise UserError(_("You have to define an 'Internal Transfer Account' in your cash register's journal."))
|
||||
amount = self.amount or 0.0
|
||||
return {
|
||||
'date': record.date,
|
||||
|
||||
@@ -128,7 +128,7 @@ class AccountAssetAsset(models.Model):
|
||||
def unlink(self):
|
||||
for asset in self:
|
||||
if asset.state in ['open', 'close']:
|
||||
raise UserError(_('You cannot delete a document is in %s state.') % (asset.state,))
|
||||
raise UserError(_('You cannot delete a document that is in %s state.') % (asset.state,))
|
||||
for depreciation_line in asset.depreciation_line_ids:
|
||||
if depreciation_line.move_id:
|
||||
raise UserError(_('You cannot delete a document that contains posted entries.'))
|
||||
@@ -388,7 +388,7 @@ class AccountAssetAsset(models.Model):
|
||||
@api.constrains('prorata', 'method_time')
|
||||
def _check_prorata(self):
|
||||
if self.prorata and self.method_time != 'number':
|
||||
raise ValidationError(_('Prorata temporis can be applied only for time method "number of depreciations".'))
|
||||
raise ValidationError(_('Prorata temporis can be applied only for the "number of depreciations" time method.'))
|
||||
|
||||
@api.onchange('category_id')
|
||||
def onchange_category_id(self):
|
||||
@@ -500,7 +500,7 @@ class AccountAssetDepreciationLine(models.Model):
|
||||
created_moves = self.env['account.move']
|
||||
for line in self:
|
||||
if line.move_id:
|
||||
raise UserError(_('This depreciation is already linked to a journal entry! Please post or delete it.'))
|
||||
raise UserError(_('This depreciation is already linked to a journal entry. Please post or delete it.'))
|
||||
move_vals = self._prepare_move(line)
|
||||
move = self.env['account.move'].create(move_vals)
|
||||
line.write({'move_id': move.id, 'move_check': True})
|
||||
|
||||
@@ -60,7 +60,7 @@ class AccountInvoiceLine(models.Model):
|
||||
cat = self.asset_category_id
|
||||
if cat:
|
||||
if cat.method_number == 0 or cat.method_period == 0:
|
||||
raise UserError(_('The number of depreciations or the period length of your asset category cannot be null.'))
|
||||
raise UserError(_('The number of depreciations or the period length of your asset category cannot be 0.'))
|
||||
months = cat.method_number * cat.method_period
|
||||
if self.invoice_id.type in ['out_invoice', 'out_refund']:
|
||||
self.asset_mrr = self.price_subtotal_signed / months
|
||||
|
||||
@@ -160,7 +160,7 @@ class AccountBankStatementImport(models.TransientModel):
|
||||
if currency and currency != journal_currency:
|
||||
statement_cur_code = not currency and company_currency.name or currency.name
|
||||
journal_cur_code = not journal_currency and company_currency.name or journal_currency.name
|
||||
raise UserError(_('The currency of the bank statement (%s) is not the same as the currency of the journal (%s) !') % (statement_cur_code, journal_cur_code))
|
||||
raise UserError(_('The currency of the bank statement (%s) is not the same as the currency of the journal (%s).') % (statement_cur_code, journal_cur_code))
|
||||
|
||||
# If we couldn't find / can't create a journal, everything is lost
|
||||
if not journal and not account_number:
|
||||
@@ -221,7 +221,7 @@ class AccountBankStatementImport(models.TransientModel):
|
||||
st_vals['line_ids'] = [[0, False, line] for line in filtered_st_lines]
|
||||
statement_ids.append(BankStatement.create(st_vals).id)
|
||||
if len(statement_ids) == 0:
|
||||
raise UserError(_('You have already imported that file.'))
|
||||
raise UserError(_('You already have imported that file.'))
|
||||
|
||||
# Prepare import feedback
|
||||
notifications = []
|
||||
|
||||
@@ -453,7 +453,7 @@ class AccountVoucherLine(models.Model):
|
||||
company = self.env['res.company'].browse(company_id)
|
||||
currency = self.env['res.currency'].browse(currency_id)
|
||||
if not partner_id:
|
||||
raise UserError(_("You must first select a partner!"))
|
||||
raise UserError(_("You must first select a partner."))
|
||||
part = self.env['res.partner'].browse(partner_id)
|
||||
if part.lang:
|
||||
self = self.with_context(lang=part.lang)
|
||||
|
||||
@@ -28,7 +28,7 @@ def get_bban_from_iban(iban):
|
||||
def validate_iban(iban):
|
||||
iban = normalize_iban(iban)
|
||||
if not iban:
|
||||
raise ValidationError(_("No IBAN !"))
|
||||
raise ValidationError(_("There is no IBAN code."))
|
||||
|
||||
country_code = iban[:2].lower()
|
||||
if country_code not in _map_iban_template:
|
||||
|
||||
@@ -54,7 +54,7 @@ class IrModule(models.Model):
|
||||
)
|
||||
raise UserError(err)
|
||||
elif 'web_studio' not in installed_mods and _is_studio_custom(path):
|
||||
raise UserError(_("Studio customizations require Studio"))
|
||||
raise UserError(_("Studio customizations require the Odoo Studio app."))
|
||||
|
||||
mod = known_mods_names.get(module)
|
||||
if mod:
|
||||
@@ -112,7 +112,7 @@ class IrModule(models.Model):
|
||||
if not module_file:
|
||||
raise Exception(_("No file sent."))
|
||||
if not zipfile.is_zipfile(module_file):
|
||||
raise UserError(_('File is not a zip file!'))
|
||||
raise UserError(_('Only zip files are supported.'))
|
||||
|
||||
success = []
|
||||
errors = dict()
|
||||
|
||||
@@ -924,9 +924,9 @@ class Meeting(models.Model):
|
||||
def _check_closing_date(self):
|
||||
for meeting in self:
|
||||
if meeting.start_datetime and meeting.stop_datetime and meeting.stop_datetime < meeting.start_datetime:
|
||||
raise ValidationError(_('Ending datetime cannot be set before starting datetime.'))
|
||||
raise ValidationError(_('The ending date and time cannot be earlier than the starting date and time.'))
|
||||
if meeting.start_date and meeting.stop_date and meeting.stop_date < meeting.start_date:
|
||||
raise ValidationError(_('Ending date cannot be set before starting date.'))
|
||||
raise ValidationError(_('The ending date cannot be earlier than the starting date.'))
|
||||
|
||||
@api.onchange('start_datetime', 'duration')
|
||||
def _onchange_duration(self):
|
||||
|
||||
@@ -118,7 +118,7 @@ class Team(models.Model):
|
||||
@api.constrains('dashboard_graph_model', 'use_opportunities')
|
||||
def _check_graph_model(self):
|
||||
if not self.use_opportunities and self.dashboard_graph_model == 'crm.opportunity.report':
|
||||
raise ValidationError(_("Dashboard graph content cannot be Pipeline if the sales channel doesn't use it. (Pipeline is unchecked.)"))
|
||||
raise ValidationError(_("You have to enable the Pipeline on your sales channel to be able to set it as a content for the graph"))
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
|
||||
@@ -108,7 +108,7 @@ class ProviderGrid(models.Model):
|
||||
for p in pickings:
|
||||
carrier = self._match_address(p.partner_id)
|
||||
if not carrier:
|
||||
raise ValidationError(_('Error: no matching grid.'))
|
||||
raise ValidationError(_('There is no matching delivery rule.'))
|
||||
res = res + [{'exact_price': p.carrier_id._get_price_available(p.sale_id) if p.sale_id else 0.0, # TODO cleanme
|
||||
'tracking_number': False}]
|
||||
return res
|
||||
|
||||
@@ -261,7 +261,7 @@ class EventEvent(models.Model):
|
||||
@api.constrains('date_begin', 'date_end')
|
||||
def _check_closing_date(self):
|
||||
if self.date_end < self.date_begin:
|
||||
raise ValidationError(_('Closing Date cannot be set before Beginning Date.'))
|
||||
raise ValidationError(_('The closing date cannot be earlier than the beginning date.'))
|
||||
|
||||
@api.multi
|
||||
@api.depends('name', 'date_begin', 'date_end')
|
||||
|
||||
@@ -149,12 +149,12 @@ class EventTicket(models.Model):
|
||||
def _check_seats_limit(self):
|
||||
for record in self:
|
||||
if record.seats_max and record.seats_available < 0:
|
||||
raise ValidationError(_('No more available seats for the ticket'))
|
||||
raise ValidationError(_('No more available seats for this ticket type.'))
|
||||
|
||||
@api.constrains('event_type_id', 'event_id')
|
||||
def _constrains_event(self):
|
||||
if any(ticket.event_type_id and ticket.event_id for ticket in self):
|
||||
raise UserError(_('Ticket should belong to either event category or event but not both'))
|
||||
raise UserError(_('Ticket cannot belong to both the event category and the event itself.'))
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product_id(self):
|
||||
|
||||
@@ -21,7 +21,7 @@ class grant_badge_wizard(models.TransientModel):
|
||||
uid = self.env.uid
|
||||
for wiz in self:
|
||||
if uid == wiz.user_id.id:
|
||||
raise exceptions.UserError(_('You can not grant a badge to yourself'))
|
||||
raise exceptions.UserError(_('You can not grant a badge to yourself.'))
|
||||
|
||||
#create the badge
|
||||
BadgeUser.create({
|
||||
|
||||
@@ -127,7 +127,7 @@ class GoogleService(models.TransientModel):
|
||||
client_secret = get_param('google_%s_client_secret' % (service,), default=False)
|
||||
|
||||
if not client_id or not client_secret:
|
||||
raise UserError(_("The account for the Google service '%s' is not configured") % service)
|
||||
raise UserError(_("The account for the Google service '%s' is not configured.") % service)
|
||||
|
||||
headers = {"content-type": "application/x-www-form-urlencoded"}
|
||||
data = {
|
||||
|
||||
@@ -39,7 +39,7 @@ class GoogleDrive(models.Model):
|
||||
try:
|
||||
name_gdocs = name_gdocs % record
|
||||
except:
|
||||
raise UserError(_("At least one key cannot be found in your Google Drive name pattern"))
|
||||
raise UserError(_("At least one key cannot be found in your Google Drive name pattern."))
|
||||
|
||||
attachments = self.env["ir.attachment"].search([('res_model', '=', model.model), ('name', '=', name_gdocs), ('res_id', '=', res_id)])
|
||||
url = False
|
||||
|
||||
@@ -80,7 +80,7 @@ class GoogleDrive(models.Model):
|
||||
timeout=TIMEOUT,
|
||||
)
|
||||
except IOError:
|
||||
_logger.warning("An error occured while writting the formula on the Google Spreadsheet.")
|
||||
_logger.warning("An error occured while writing the formula on the Google Spreadsheet.")
|
||||
|
||||
description = '''
|
||||
formula: %s
|
||||
|
||||
@@ -203,7 +203,7 @@ class Employee(models.Model):
|
||||
def _check_parent_id(self):
|
||||
for employee in self:
|
||||
if not employee._check_recursion():
|
||||
raise ValidationError(_('Error! You cannot create recursive hierarchy of Employee(s).'))
|
||||
raise ValidationError(_('You cannot create a recursive hierarchy.'))
|
||||
|
||||
@api.onchange('job_id')
|
||||
def _onchange_job_id(self):
|
||||
@@ -299,7 +299,7 @@ class Department(models.Model):
|
||||
@api.constrains('parent_id')
|
||||
def _check_parent_id(self):
|
||||
if not self._check_recursion():
|
||||
raise ValidationError(_('Error! You cannot create recursive departments.'))
|
||||
raise ValidationError(_('You cannot create recursive departments.'))
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
|
||||
@@ -96,7 +96,7 @@ class Contract(models.Model):
|
||||
@api.constrains('date_start', 'date_end')
|
||||
def _check_dates(self):
|
||||
if self.filtered(lambda c: c.date_end and c.date_start > c.date_end):
|
||||
raise ValidationError(_('Contract start date must be less than contract end date.'))
|
||||
raise ValidationError(_('Contract start date must be earlier than contract end date.'))
|
||||
|
||||
@api.model
|
||||
def update_state(self):
|
||||
|
||||
@@ -133,7 +133,7 @@ class HrExpense(models.Model):
|
||||
@api.onchange('product_uom_id')
|
||||
def _onchange_product_uom_id(self):
|
||||
if self.product_id and self.product_uom_id.category_id != self.product_id.uom_id.category_id:
|
||||
raise UserError(_('Selected Unit of Measure does not belong to the same category as the product Unit of Measure'))
|
||||
raise UserError(_('Selected Unit of Measure does not belong to the same category as the product Unit of Measure.'))
|
||||
|
||||
# ----------------------------------------
|
||||
# ORM Overrides
|
||||
@@ -180,7 +180,7 @@ class HrExpense(models.Model):
|
||||
if any(expense.state != 'draft' for expense in self):
|
||||
raise UserError(_("You cannot report twice the same line!"))
|
||||
if len(self.mapped('employee_id')) != 1:
|
||||
raise UserError(_("You cannot report expenses for different employees in the same report!"))
|
||||
raise UserError(_("You cannot report expenses for different employees in the same report."))
|
||||
return {
|
||||
'name': _('New Expense Report'),
|
||||
'type': 'ir.actions.act_window',
|
||||
@@ -553,14 +553,14 @@ class HrExpenseSheet(models.Model):
|
||||
for sheet in self:
|
||||
expense_lines = sheet.mapped('expense_line_ids')
|
||||
if expense_lines and any(expense.payment_mode != expense_lines[0].payment_mode for expense in expense_lines):
|
||||
raise ValidationError(_("Expenses must have been paid by the same entity (Company or employee)"))
|
||||
raise ValidationError(_("Expenses must be paid by the same entity (Company or employee)."))
|
||||
|
||||
@api.constrains('expense_line_ids', 'employee_id')
|
||||
def _check_employee(self):
|
||||
for sheet in self:
|
||||
employee_ids = sheet.expense_line_ids.mapped('employee_id')
|
||||
if len(employee_ids) > 1 or (len(employee_ids) == 1 and employee_ids != sheet.employee_id):
|
||||
raise ValidationError(_('You cannot add expense lines of another employee.'))
|
||||
raise ValidationError(_('You cannot add expenses of another employee.'))
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
|
||||
@@ -18,7 +18,7 @@ class GamificationBadgeUserWizard(models.TransientModel):
|
||||
raise UserError(_('You can send badges only to employees linked to a user.'))
|
||||
|
||||
if self.env.uid == self.user_id.id:
|
||||
raise UserError(_('You can not send a badge to yourself'))
|
||||
raise UserError(_('You can not send a badge to yourself.'))
|
||||
|
||||
values = {
|
||||
'user_id': self.user_id.id,
|
||||
|
||||
@@ -145,7 +145,7 @@ class Employee(models.Model):
|
||||
if leave.validation_type == 'both':
|
||||
leave.action_validate()
|
||||
elif difference < 0:
|
||||
raise UserError(_('You cannot reduce validated allocation requests'))
|
||||
raise UserError(_('You cannot reduce validated allocation requests.'))
|
||||
|
||||
@api.multi
|
||||
def _compute_leave_status(self):
|
||||
|
||||
@@ -207,7 +207,7 @@ class HolidaysRequest(models.Model):
|
||||
]
|
||||
nholidays = self.search_count(domain)
|
||||
if nholidays:
|
||||
raise ValidationError(_('You can not have 2 leaves that overlaps on same day!'))
|
||||
raise ValidationError(_('You can not have 2 leaves that overlaps on the same day.'))
|
||||
|
||||
@api.constrains('state', 'number_of_days_temp', 'holiday_status_id')
|
||||
def _check_holidays(self):
|
||||
@@ -218,7 +218,7 @@ class HolidaysRequest(models.Model):
|
||||
if float_compare(leave_days['remaining_leaves'], 0, precision_digits=2) == -1 or \
|
||||
float_compare(leave_days['virtual_remaining_leaves'], 0, precision_digits=2) == -1:
|
||||
raise ValidationError(_('The number of remaining leaves is not sufficient for this leave type.\n'
|
||||
'Please verify also the leaves waiting for validation.'))
|
||||
'Please also check the leaves waiting for validation.'))
|
||||
|
||||
def _get_number_of_days(self, date_from, date_to, employee_id):
|
||||
""" Returns a float equals to the timedelta between two dates given as string."""
|
||||
@@ -373,9 +373,9 @@ class HolidaysRequest(models.Model):
|
||||
def action_draft(self):
|
||||
for holiday in self:
|
||||
if not holiday.can_reset:
|
||||
raise UserError(_('Only an HR Manager or the concerned employee can reset to draft.'))
|
||||
raise UserError(_('Only an HR Manager or the concerned employee can reset the leave request to draft.'))
|
||||
if holiday.state not in ['confirm', 'refuse']:
|
||||
raise UserError(_('Leave request state must be "Refused" or "To Approve" in order to reset to Draft.'))
|
||||
raise UserError(_('Leave request state must be "Refused" or "To Approve" in order to be reset to draft.'))
|
||||
holiday.write({
|
||||
'state': 'draft',
|
||||
'first_approver_id': False,
|
||||
@@ -414,7 +414,7 @@ class HolidaysRequest(models.Model):
|
||||
and not self.env.user.has_group('hr_holidays.group_hr_holidays_manager'):
|
||||
raise UserError(_('You must be %s manager to approve this leave') % (holiday.employee_id.name))
|
||||
elif validation_type == 'manager' and not self.env.user.has_group('hr_holidays.group_hr_holidays_manager'):
|
||||
raise UserError(_('You must be a Human Resource Manager to approve this Leave'))
|
||||
raise UserError(_('You must be a Human Resource Manager to approve this leave.'))
|
||||
|
||||
self.filtered(lambda hol: hol.validation_type == 'both').write({'state': 'validate1', 'first_approver_id': current_employee.id})
|
||||
self.filtered(lambda hol: not hol.validation_type == 'both').action_validate()
|
||||
|
||||
@@ -257,7 +257,7 @@ class HolidaysAllocation(models.Model):
|
||||
and not self.env.user.has_group('hr_holidays.group_hr_holidays_manager'):
|
||||
raise UserError(_('You must be %s manager to approve this leave') % (holiday.employee_id.name))
|
||||
elif validation_type == 'manager' and not self.env.user.has_group('hr_holidays.group_hr_holidays_manager'):
|
||||
raise UserError(_('You must be a Human Resource Manager to approve this Leave'))
|
||||
raise UserError(_('You must be a Human Resource Manager to approve this Leave.'))
|
||||
|
||||
self.filtered(lambda hol: hol.validation_type == 'both').write({'state': 'validate1', 'first_approver_id': current_employee.id})
|
||||
self.filtered(lambda hol: not hol.validation_type == 'both').action_validate()
|
||||
|
||||
@@ -24,7 +24,7 @@ class HolidaysSummaryDept(models.TransientModel):
|
||||
self.ensure_one()
|
||||
[data] = self.read()
|
||||
if not data.get('depts'):
|
||||
raise UserError(_('You have to select at least one Department. And try again.'))
|
||||
raise UserError(_('You have to select at least one department.'))
|
||||
departments = self.env['hr.department'].browse(data['depts'])
|
||||
datas = {
|
||||
'ids': [],
|
||||
|
||||
@@ -81,7 +81,7 @@ class HrPayslip(models.Model):
|
||||
@api.constrains('date_from', 'date_to')
|
||||
def _check_dates(self):
|
||||
if any(self.filtered(lambda payslip: payslip.date_from > payslip.date_to)):
|
||||
raise ValidationError(_("Payslip 'Date From' must be before 'Date To'."))
|
||||
raise ValidationError(_("Payslip 'Date From' must be earlier 'Date To'."))
|
||||
|
||||
@api.multi
|
||||
def action_payslip_draft(self):
|
||||
|
||||
@@ -33,7 +33,7 @@ class HrPayrollStructure(models.Model):
|
||||
@api.constrains('parent_id')
|
||||
def _check_parent_id(self):
|
||||
if not self._check_recursion():
|
||||
raise ValidationError(_('Error ! You cannot create a recursive Salary Structure.'))
|
||||
raise ValidationError(_('You cannot create a recursive salary structure.'))
|
||||
|
||||
@api.multi
|
||||
@api.returns('self', lambda value: value.id)
|
||||
|
||||
@@ -153,7 +153,7 @@ class Task(models.Model):
|
||||
project_id = values.get('project_id')
|
||||
# a timesheet must have an analytic account (and a project)
|
||||
if self and not project_id:
|
||||
raise UserError(_('This task must have a project since they are linked to timesheets.'))
|
||||
raise UserError(_('This task must be part of a project because they some timesheets are linked to it.'))
|
||||
self.sudo().mapped('timesheet_ids').write({
|
||||
'project_id': project_id,
|
||||
'account_id': self.env['project.project'].browse(project_id).sudo().analytic_account_id.id
|
||||
|
||||
@@ -225,7 +225,7 @@ class HrContract(models.Model):
|
||||
@api.onchange('mobile', 'mobile_plus')
|
||||
def _onchange_mobile(self):
|
||||
if self.mobile_plus and not self.mobile:
|
||||
raise ValidationError(_('You should have a mobile subscription to select an international communication amount!'))
|
||||
raise ValidationError(_('You should have a mobile subscription to select an international communication amount.'))
|
||||
|
||||
def _get_internet_amount(self, has_internet):
|
||||
if has_internet:
|
||||
|
||||
@@ -34,7 +34,7 @@ class AccountInvoice(models.Model):
|
||||
def _check_communication(self):
|
||||
for inv in self:
|
||||
if inv.reference_type == 'bba' and not self.check_bbacomm(inv.reference):
|
||||
raise ValidationError(_('Invalid BBA Structured Communication !'))
|
||||
raise ValidationError(_('Invalid BBA Structured Communication.'))
|
||||
|
||||
def check_bbacomm(self, val):
|
||||
supported_chars = '0-9+*/ '
|
||||
|
||||
@@ -763,7 +763,7 @@ class MassMailing(models.Model):
|
||||
if not res_ids:
|
||||
res_ids = mailing.get_remaining_recipients()
|
||||
if not res_ids:
|
||||
raise UserError(_('Please select recipients.'))
|
||||
raise UserError(_('There is no recipients selected.'))
|
||||
|
||||
# Convert links in absolute URLs before the application of the shortener
|
||||
mailing.body_html = self.env['mail.thread']._replace_local_links(mailing.body_html)
|
||||
|
||||
@@ -156,7 +156,7 @@ class Partner(models.Model):
|
||||
while self:
|
||||
self = self.associate_member
|
||||
if not level:
|
||||
raise ValidationError(_('Error ! You cannot create recursive associated members.'))
|
||||
raise ValidationError(_('You cannot create recursive associated members.'))
|
||||
level -= 1
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -86,7 +86,7 @@ class MrpUnbuild(models.Model):
|
||||
def action_unbuild(self):
|
||||
self.ensure_one()
|
||||
if self.product_id.tracking != 'none' and not self.lot_id.id:
|
||||
raise UserError(_('Should have a lot for the finished product'))
|
||||
raise UserError(_('You should provide a lot number for the final product.'))
|
||||
|
||||
if self.mo_id:
|
||||
if self.mo_id.state != 'done':
|
||||
|
||||
@@ -160,7 +160,7 @@ class MrpWorkcenter(models.Model):
|
||||
def unblock(self):
|
||||
self.ensure_one()
|
||||
if self.working_state != 'blocked':
|
||||
raise exceptions.UserError(_("It has been unblocked already. "))
|
||||
raise exceptions.UserError(_("It has already been unblocked."))
|
||||
times = self.env['mrp.workcenter.productivity'].search([('workcenter_id', '=', self.id), ('date_end', '=', False)])
|
||||
times.write({'date_end': fields.Datetime.now()})
|
||||
return {'type': 'ir.actions.client', 'tag': 'reload'}
|
||||
|
||||
@@ -297,7 +297,7 @@ class MrpWorkorder(models.Model):
|
||||
raise UserError(_('Please set the quantity you are currently producing. It should be different from zero.'))
|
||||
|
||||
if (self.production_id.product_id.tracking != 'none') and not self.final_lot_id and self.move_raw_ids:
|
||||
raise UserError(_('You should provide a lot/serial number for the final product'))
|
||||
raise UserError(_('You should provide a lot/serial number for the final product.'))
|
||||
|
||||
# Update quantities done on each raw material line
|
||||
# For each untracked component without any 'temporary' move lines,
|
||||
@@ -320,7 +320,7 @@ class MrpWorkorder(models.Model):
|
||||
move_line.sudo().unlink()
|
||||
continue
|
||||
if move_line.product_id.tracking != 'none' and not move_line.lot_id:
|
||||
raise UserError(_('You should provide a lot/serial number for a component'))
|
||||
raise UserError(_('You should provide a lot/serial number for a component.'))
|
||||
# Search other move_line where it could be added:
|
||||
lots = self.move_line_ids.filtered(lambda x: (x.lot_id.id == move_line.lot_id.id) and (not x.lot_produced_id) and (not x.done_move) and (x.product_id == move_line.product_id))
|
||||
if lots:
|
||||
@@ -487,7 +487,7 @@ class MrpWorkorder(models.Model):
|
||||
@api.multi
|
||||
def button_done(self):
|
||||
if any([x.state in ('done', 'cancel') for x in self]):
|
||||
raise UserError(_('A Manufacturing Order is already done or cancelled!'))
|
||||
raise UserError(_('A Manufacturing Order is already done or cancelled.'))
|
||||
self.end_all()
|
||||
return self.write({'state': 'done',
|
||||
'date_finished': datetime.now()})
|
||||
|
||||
@@ -91,7 +91,7 @@ class MrpProductProduce(models.TransientModel):
|
||||
# Nothing to do for lots since values are created using default data (stock.move.lots)
|
||||
quantity = self.product_qty
|
||||
if float_compare(quantity, 0, precision_rounding=self.product_uom_id.rounding) <= 0:
|
||||
raise UserError(_("The production order for '%s' has no quantity specified") % self.product_id.display_name)
|
||||
raise UserError(_("The production order for '%s' has no quantity specified.") % self.product_id.display_name)
|
||||
for move in self.production_id.move_raw_ids:
|
||||
# TODO currently not possible to guess if the user updated quantity by hand or automatically by the produce wizard.
|
||||
if move.product_id.tracking == 'none' and move.state not in ('done', 'cancel') and move.unit_factor:
|
||||
@@ -122,7 +122,7 @@ class MrpProductProduce(models.TransientModel):
|
||||
produce_move = self.production_id.move_finished_ids.filtered(lambda x: x.product_id == self.product_id and x.state not in ('done', 'cancel'))
|
||||
if produce_move and produce_move.product_id.tracking != 'none':
|
||||
if not self.lot_id:
|
||||
raise UserError(_('You need to provide a lot for the finished product'))
|
||||
raise UserError(_('You need to provide a lot for the finished product.'))
|
||||
existing_move_line = produce_move.move_line_ids.filtered(lambda x: x.lot_id == self.lot_id)
|
||||
if existing_move_line:
|
||||
if self.product_id.tracking == 'serial':
|
||||
|
||||
@@ -29,7 +29,7 @@ class MrpSubProduct(models.Model):
|
||||
if self.product_uom_id and self.product_id and self.product_uom_id.category_id != self.product_id.uom_id.category_id:
|
||||
res['warning'] = {
|
||||
'title': _('Warning'),
|
||||
'message': _('The Product Unit of Measure you chose has a different category than in the product form.')
|
||||
'message': _('The unit of measure you chose is in a different category than the product unit of measure.')
|
||||
}
|
||||
self.product_uom_id = self.product_id.uom_id.id
|
||||
return res
|
||||
|
||||
@@ -219,22 +219,22 @@ class PosConfig(models.Model):
|
||||
@api.constrains('company_id', 'stock_location_id')
|
||||
def _check_company_location(self):
|
||||
if self.stock_location_id.company_id and self.stock_location_id.company_id.id != self.company_id.id:
|
||||
raise ValidationError(_("The company of the stock location is different than the one of point of sale"))
|
||||
raise ValidationError(_("The stock location and the point of sale must belong to the same company."))
|
||||
|
||||
@api.constrains('company_id', 'journal_id')
|
||||
def _check_company_journal(self):
|
||||
if self.journal_id and self.journal_id.company_id.id != self.company_id.id:
|
||||
raise ValidationError(_("The company of the sales journal is different than the one of point of sale"))
|
||||
raise ValidationError(_("The sales journal and the point of sale must belong to the same company."))
|
||||
|
||||
@api.constrains('company_id', 'invoice_journal_id')
|
||||
def _check_company_invoice_journal(self):
|
||||
if self.invoice_journal_id and self.invoice_journal_id.company_id.id != self.company_id.id:
|
||||
raise ValidationError(_("The invoice journal and the point of sale must belong to the same company"))
|
||||
raise ValidationError(_("The invoice journal and the point of sale must belong to the same company."))
|
||||
|
||||
@api.constrains('company_id', 'journal_ids')
|
||||
def _check_company_payment(self):
|
||||
if self.env['account.journal'].search_count([('id', 'in', self.journal_ids.ids), ('company_id', '!=', self.company_id.id)]):
|
||||
raise ValidationError(_("The company of a payment method is different than the one of point of sale"))
|
||||
raise ValidationError(_("The method payments and the point of sale must belong to the same company."))
|
||||
|
||||
@api.constrains('pricelist_id', 'available_pricelist_ids', 'journal_id', 'invoice_journal_id', 'journal_ids')
|
||||
def _check_currencies(self):
|
||||
|
||||
@@ -994,7 +994,7 @@ class PosOrderLine(models.Model):
|
||||
def _onchange_qty(self):
|
||||
if self.product_id:
|
||||
if not self.order_id.pricelist_id:
|
||||
raise UserError(_('You have to select a pricelist in the sale form !'))
|
||||
raise UserError(_('You have to select a pricelist in the sale form.'))
|
||||
price = self.price_unit * (1 - (self.discount or 0.0) / 100.0)
|
||||
self.price_subtotal = self.price_subtotal_incl = price * self.qty
|
||||
if (self.product_id.taxes_id):
|
||||
|
||||
@@ -148,7 +148,7 @@ class PosSession(models.Model):
|
||||
('user_id', '=', self.user_id.id),
|
||||
('rescue', '=', False)
|
||||
]) > 1:
|
||||
raise ValidationError(_("You cannot create two active sessions with the same responsible!"))
|
||||
raise ValidationError(_("You cannot create two active sessions with the same responsible."))
|
||||
|
||||
@api.constrains('config_id')
|
||||
def _check_pos_config(self):
|
||||
@@ -280,7 +280,7 @@ class PosSession(models.Model):
|
||||
if not self.user_has_groups("point_of_sale.group_pos_manager"):
|
||||
raise UserError(_("Your ending balance is too different from the theoretical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it.") % (st.difference, st.journal_id.amount_authorized_diff))
|
||||
if (st.journal_id.type not in ['bank', 'cash']):
|
||||
raise UserError(_("The type of the journal for your payment method should be bank or cash "))
|
||||
raise UserError(_("The journal type for your payment method should be bank or cash."))
|
||||
st.with_context(ctx).sudo().button_confirm_bank()
|
||||
self.with_context(ctx)._confirm_orders()
|
||||
self.write({'state': 'closed'})
|
||||
|
||||
@@ -18,7 +18,7 @@ class MercuryTransaction(models.Model):
|
||||
def _get_pos_session(self):
|
||||
pos_session = self.env['pos.session'].search([('state', '=', 'opened'), ('user_id', '=', self.env.uid)], limit=1)
|
||||
if not pos_session:
|
||||
raise UserError(_("No opened point of sale session for user %s found") % self.env.user.name)
|
||||
raise UserError(_("No opened point of sale session for user %s found.") % self.env.user.name)
|
||||
|
||||
pos_session.login()
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class ProductCategory(models.Model):
|
||||
@api.constrains('parent_id')
|
||||
def _check_category_recursion(self):
|
||||
if not self._check_recursion():
|
||||
raise ValidationError(_('Error ! You cannot create recursive categories.'))
|
||||
raise ValidationError(_('You cannot create recursive categories.'))
|
||||
return True
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -98,7 +98,7 @@ class ProductAttributeLine(models.Model):
|
||||
@api.constrains('value_ids', 'attribute_id')
|
||||
def _check_valid_attribute(self):
|
||||
if any(line.value_ids > line.attribute_id.value_ids for line in self):
|
||||
raise ValidationError(_('Error ! You cannot use this attribute with the following value.'))
|
||||
raise ValidationError(_('You cannot use this attribute with the following value.'))
|
||||
return True
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -418,13 +418,13 @@ class PricelistItem(models.Model):
|
||||
@api.constrains('base_pricelist_id', 'pricelist_id', 'base')
|
||||
def _check_recursion(self):
|
||||
if any(item.base == 'pricelist' and item.pricelist_id and item.pricelist_id == item.base_pricelist_id for item in self):
|
||||
raise ValidationError(_('Error! You cannot assign the Main Pricelist as Other Pricelist in PriceList Item!'))
|
||||
raise ValidationError(_('You cannot assign the Main Pricelist as Other Pricelist in PriceList Item'))
|
||||
return True
|
||||
|
||||
@api.constrains('price_min_margin', 'price_max_margin')
|
||||
def _check_margin(self):
|
||||
if any(item.price_min_margin > item.price_max_margin for item in self):
|
||||
raise ValidationError(_('Error! The minimum margin should be lower than the maximum margin.'))
|
||||
raise ValidationError(_('The minimum margin should be lower than the maximum margin.'))
|
||||
return True
|
||||
|
||||
@api.one
|
||||
|
||||
@@ -300,7 +300,7 @@ class ProductTemplate(models.Model):
|
||||
@api.constrains('uom_id', 'uom_po_id')
|
||||
def _check_uom(self):
|
||||
if any(template.uom_id and template.uom_po_id and template.uom_id.category_id != template.uom_po_id.category_id for template in self):
|
||||
raise ValidationError(_('Error: The default Unit of Measure and the purchase Unit of Measure must be in the same category.'))
|
||||
raise ValidationError(_('The default Unit of Measure and the purchase Unit of Measure must be in the same category.'))
|
||||
return True
|
||||
|
||||
@api.onchange('uom_id')
|
||||
|
||||
@@ -84,7 +84,7 @@ class Project(models.Model):
|
||||
def unlink(self):
|
||||
for project in self:
|
||||
if project.tasks:
|
||||
raise UserError(_('You cannot delete a project containing tasks. You can either delete all the project\'s tasks and then delete the project or simply deactivate the project.'))
|
||||
raise UserError(_('You cannot delete a project containing tasks. You can either archive it or first delete all of its tasks.'))
|
||||
return super(Project, self).unlink()
|
||||
|
||||
def _compute_attached_docs_count(self):
|
||||
@@ -609,7 +609,7 @@ class Task(models.Model):
|
||||
def _check_subtask_level(self):
|
||||
for task in self:
|
||||
if task.parent_id and task.child_ids:
|
||||
raise ValidationError(_('Task %s can not have a parent task and subtasks. Only one subtask level is allowed.' % (task.name,)))
|
||||
raise ValidationError(_('Task %s cannot have several subtask levels.' % (task.name,)))
|
||||
|
||||
@api.multi
|
||||
@api.returns('self', lambda value: value.id)
|
||||
|
||||
@@ -35,7 +35,7 @@ class HolidaysType(models.Model):
|
||||
for holiday_status in self:
|
||||
if holiday_status.timesheet_generate:
|
||||
if not holiday_status.timesheet_project_id or not holiday_status.timesheet_task_id:
|
||||
raise ValidationError(_('For the leaves to generate timesheet, the internal project and task are requried.'))
|
||||
raise ValidationError(_('Both the internal project and task are required to generate timesheet for the leaves.'))
|
||||
|
||||
|
||||
class Holidays(models.Model):
|
||||
|
||||
@@ -322,7 +322,7 @@ class PurchaseOrder(models.Model):
|
||||
for order in self:
|
||||
for inv in order.invoice_ids:
|
||||
if inv and inv.state not in ('cancel', 'draft'):
|
||||
raise UserError(_("Unable to cancel this purchase order. You must first cancel related vendor bills."))
|
||||
raise UserError(_("Unable to cancel this purchase order. You must first cancel the related vendor bills."))
|
||||
self.write({'state': 'cancel'})
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -119,7 +119,7 @@ class StockWarehouse(models.Model):
|
||||
buy_route_id = self.env['stock.location.route'].search([('name', 'like', _('Buy'))])
|
||||
buy_route_id = buy_route_id[0].id if buy_route_id else False
|
||||
if not buy_route_id:
|
||||
raise UserError(_("Can't find any generic Buy route."))
|
||||
raise UserError(_("Can't find any Buy route. Please create a route with the 'Buy' action for your receipts operation types."))
|
||||
|
||||
return {
|
||||
'name': self._format_routename(_(' Buy')),
|
||||
|
||||
@@ -169,7 +169,7 @@ class Repair(models.Model):
|
||||
if not self.product_id or not self.product_uom:
|
||||
return res
|
||||
if self.product_uom.category_id != self.product_id.uom_id.category_id:
|
||||
res['warning'] = {'title': _('Warning'), 'message': _('The Product Unit of Measure you chose has a different category than in the product form.')}
|
||||
res['warning'] = {'title': _('Warning'), 'message': _('The product unit of measure you chose has a different category than the product unit of measure.')}
|
||||
self.product_uom = self.product_id.uom_id.id
|
||||
return res
|
||||
|
||||
@@ -227,7 +227,7 @@ class Repair(models.Model):
|
||||
@return: True
|
||||
"""
|
||||
if self.filtered(lambda repair: repair.state != 'draft'):
|
||||
raise UserError(_("Can only confirm draft repairs."))
|
||||
raise UserError(_("Only draft repairs can be confirmed."))
|
||||
before_repair = self.filtered(lambda repair: repair.invoice_method == 'b4repair')
|
||||
before_repair.write({'state': '2binvoiced'})
|
||||
to_confirm = self - before_repair
|
||||
@@ -241,7 +241,7 @@ class Repair(models.Model):
|
||||
if self.filtered(lambda repair: repair.state == 'done'):
|
||||
raise UserError(_("Cannot cancel completed repairs."))
|
||||
if any(repair.invoiced for repair in self):
|
||||
raise UserError(_('Repair order is already invoiced.'))
|
||||
raise UserError(_('The repair order is already invoiced.'))
|
||||
self.mapped('operations').write({'state': 'cancel'})
|
||||
return self.write({'state': 'cancel'})
|
||||
|
||||
@@ -290,7 +290,7 @@ class Repair(models.Model):
|
||||
Invoice = self.env['account.invoice']
|
||||
for repair in self.filtered(lambda repair: repair.state not in ('draft', 'cancel') and not repair.invoice_id):
|
||||
if not repair.partner_id.id and not repair.partner_invoice_id.id:
|
||||
raise UserError(_('You have to select a Partner Invoice Address in the repair form!'))
|
||||
raise UserError(_('You have to select an invoice address in the repair form.'))
|
||||
comment = repair.quotation_notes
|
||||
if repair.invoice_method != 'none':
|
||||
if group and repair.partner_invoice_id.id in invoices_group:
|
||||
@@ -349,7 +349,7 @@ class Repair(models.Model):
|
||||
else:
|
||||
name = fee.name
|
||||
if not fee.product_id:
|
||||
raise UserError(_('No product defined on Fees!'))
|
||||
raise UserError(_('No product defined on fees.'))
|
||||
|
||||
if fee.product_id.property_account_income_id:
|
||||
account_id = fee.product_id.property_account_income_id.id
|
||||
@@ -581,14 +581,14 @@ class RepairLine(models.Model):
|
||||
warning = False
|
||||
if not pricelist:
|
||||
warning = {
|
||||
'title': _('No Pricelist!'),
|
||||
'title': _('No pricelist found.'),
|
||||
'message':
|
||||
_('You have to select a pricelist in the Repair form !\n Please set one before choosing a product.')}
|
||||
else:
|
||||
price = pricelist.get_product_price(self.product_id, self.product_uom_qty, partner)
|
||||
if price is False:
|
||||
warning = {
|
||||
'title': _('No valid pricelist line found !'),
|
||||
'title': _('No valid pricelist line found.'),
|
||||
'message':
|
||||
_("Couldn't find a pricelist line matching this product and quantity.\nYou have to change either the product, the quantity or the pricelist.")}
|
||||
else:
|
||||
@@ -639,14 +639,14 @@ class RepairFee(models.Model):
|
||||
warning = False
|
||||
if not pricelist:
|
||||
warning = {
|
||||
'title': _('No Pricelist!'),
|
||||
'title': _('No pricelist found.'),
|
||||
'message':
|
||||
_('You have to select a pricelist in the Repair form !\n Please set one before choosing a product.')}
|
||||
else:
|
||||
price = pricelist.get_product_price(self.product_id, self.product_uom_qty, partner)
|
||||
if price is False:
|
||||
warning = {
|
||||
'title': _('No valid pricelist line found !'),
|
||||
'title': _('No valid pricelist line found.'),
|
||||
'message':
|
||||
_("Couldn't find a pricelist line matching this product and quantity.\nYou have to change either the product, the quantity or the pricelist.")}
|
||||
else:
|
||||
|
||||
@@ -770,7 +770,7 @@ class ResourceCalendarLeaves(models.Model):
|
||||
@api.constrains('date_from', 'date_to')
|
||||
def check_dates(self):
|
||||
if self.filtered(lambda leave: leave.date_from > leave.date_to):
|
||||
raise ValidationError(_('Error! leave start-date must be lower then leave end-date.'))
|
||||
raise ValidationError(_('The start date of the leave must be earlier end date.'))
|
||||
|
||||
@api.onchange('resource_id')
|
||||
def onchange_resource(self):
|
||||
|
||||
@@ -186,7 +186,7 @@ class SaleOrder(models.Model):
|
||||
def unlink(self):
|
||||
for order in self:
|
||||
if order.state not in ('draft', 'cancel'):
|
||||
raise UserError(_('You can not delete a sent quotation or a sales order! Try to cancel it before.'))
|
||||
raise UserError(_('You can not delete a sent quotation or a confirmed sales order. You must first cancel it.'))
|
||||
return super(SaleOrder, self).unlink()
|
||||
|
||||
@api.multi
|
||||
@@ -454,11 +454,11 @@ class SaleOrder(models.Model):
|
||||
references[invoices[group_key]] |= order
|
||||
|
||||
if not invoices:
|
||||
raise UserError(_('There is no invoiceable line.'))
|
||||
raise UserError(_('There is no invoiceable line. If a product has a Delivered quantities invoicing policy, please make sure that a quantity has been delivered.'))
|
||||
|
||||
for invoice in invoices.values():
|
||||
if not invoice.invoice_line_ids:
|
||||
raise UserError(_('There is no invoiceable line.'))
|
||||
raise UserError(_('There is no invoiceable line. If a product has a Delivered quantities invoicing policy, please make sure that a quantity has been delivered.'))
|
||||
# If invoice is negative, do a refund invoice instead
|
||||
if invoice.amount_untaxed < 0:
|
||||
invoice.type = 'out_refund'
|
||||
|
||||
@@ -47,9 +47,9 @@ class SaleOrder(models.Model):
|
||||
"""Warn if the commitment dates is sooner than the expected date"""
|
||||
if (self.commitment_date and self.expected_date and self.commitment_date < self.expected_date):
|
||||
return {'warning': {
|
||||
'title': _('Commitment date is too soon!'),
|
||||
'message': _("The date committed by the customer is "
|
||||
"sooner than the expected date. You may be "
|
||||
'title': _('Requested date is too soon.'),
|
||||
'message': _("The date requested by the customer is "
|
||||
"sooner than the commitment date. You may be "
|
||||
"unable to honor the customer's request.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class ProjectTask(models.Model):
|
||||
for task in self:
|
||||
if task.sale_line_id:
|
||||
if not task.sale_line_id.is_service or task.sale_line_id.is_expense:
|
||||
raise ValidationError(_("The Sales order line should be one selling a service, and no coming from expense."))
|
||||
raise ValidationError(_('You cannot link the order item %s - %s to this task because it is a re-invoiced expense.' % (task.sale_line_id.order_id.id, task.sale_line_id.product_id.name)))
|
||||
|
||||
@api.model
|
||||
def create(self, values):
|
||||
@@ -120,7 +120,7 @@ class ProjectTask(models.Model):
|
||||
@api.multi
|
||||
def unlink(self):
|
||||
if any(task.sale_line_id for task in self):
|
||||
raise ValidationError(_('You cannot delete a task related to a Sales Order. You can only archive this task.'))
|
||||
raise ValidationError(_('You cannot delete a task related to a sales order. You can only archive it.'))
|
||||
return super(ProjectTask, self).unlink()
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -148,13 +148,13 @@ class Inventory(models.Model):
|
||||
if self.filter == 'none' and self.product_id and self.location_id and self.lot_id:
|
||||
return
|
||||
if self.filter not in ('product', 'product_owner') and self.product_id:
|
||||
raise UserError(_('The selected inventory options are not coherent.'))
|
||||
raise UserError(_('The selected product doesn\'t belong to that owner..'))
|
||||
if self.filter != 'lot' and self.lot_id:
|
||||
raise UserError(_('The selected inventory options are not coherent.'))
|
||||
raise UserError(_('The selected lot number doesn\'t exist.'))
|
||||
if self.filter not in ('owner', 'product_owner') and self.partner_id:
|
||||
raise UserError(_('The selected inventory options are not coherent.'))
|
||||
raise UserError(_('The selected owner doesn\'t have the proprietary of that product.'))
|
||||
if self.filter != 'pack' and self.package_id:
|
||||
raise UserError(_('The selected inventory options are not coherent.'))
|
||||
raise UserError(_('The selected inventory options are not coherent, the package doesn\'t exist.'))
|
||||
|
||||
def action_reset_product_qty(self):
|
||||
self.mapped('line_ids').write({'product_qty': 0})
|
||||
|
||||
@@ -336,7 +336,7 @@ class StockMove(models.Model):
|
||||
def _check_uom(self):
|
||||
moves_error = self.filtered(lambda move: move.product_id.uom_id.category_id != move.product_uom.category_id)
|
||||
if moves_error:
|
||||
user_warning = _('You try to move a product using a UoM that is not compatible with the UoM of the product moved. Please use an UoM in the same UoM category.')
|
||||
user_warning = _('You cannot perform the move because the unit of measure has a different category as the product unit of measure.')
|
||||
for move in moves_error:
|
||||
user_warning += _('\n\n%s --> Product UoM is %s (%s) - Move UoM is %s (%s)') % (move.product_id.display_name, move.product_id.uom_id.name, move.product_id.uom_id.category_id.name, move.product_uom.name, move.product_uom.category_id.name)
|
||||
user_warning += _('\n\nBlocking: %s') % ' ,'.join(moves_error.mapped('name'))
|
||||
@@ -488,7 +488,7 @@ class StockMove(models.Model):
|
||||
|
||||
def _do_unreserve(self):
|
||||
if any(move.state in ('done', 'cancel') for move in self):
|
||||
raise UserError(_('Cannot unreserve a done move'))
|
||||
raise UserError(_('You cannot unreserve a stock move that has been set to \'Done\'.'))
|
||||
self.mapped('move_line_ids').unlink()
|
||||
return True
|
||||
|
||||
@@ -663,7 +663,7 @@ class StockMove(models.Model):
|
||||
'warning': {
|
||||
'title': "Unsafe unit of measure",
|
||||
'message': _("You are using a unit of measure smaller than the one you are using in "
|
||||
"order to stock your product. This can lead to rounding problem on reserved quantity! "
|
||||
"order to stock your product. This can lead to rounding problem on reserved quantity. "
|
||||
"You should use the smaller unit of measure possible in order to valuate your stock or "
|
||||
"change its rounding precision to a smaller value (example: 0.00001)."),
|
||||
}
|
||||
@@ -1137,7 +1137,7 @@ class StockMove(models.Model):
|
||||
:returns: id of the backorder move created """
|
||||
self = self.with_prefetch() # This makes the ORM only look for one record and not 300 at a time, which improves performance
|
||||
if self.state in ('done', 'cancel'):
|
||||
raise UserError(_('You cannot split a move done'))
|
||||
raise UserError(_('You cannot split a stock move that has been set to \'Done\'.'))
|
||||
elif self.state == 'draft':
|
||||
# we restrict the split of a draft move because if not confirmed yet, it may be replaced by several other moves in
|
||||
# case of phantom bom (with mrp module). And we don't want to deal with this complexity by copying the product that will explode.
|
||||
|
||||
@@ -149,7 +149,7 @@ class StockMoveLine(models.Model):
|
||||
@api.constrains('qty_done')
|
||||
def _check_positive_qty_done(self):
|
||||
if any([ml.qty_done < 0 for ml in self]):
|
||||
raise ValidationError(_('You can not enter negative quantities!'))
|
||||
raise ValidationError(_('You can not enter negative quantities.'))
|
||||
|
||||
def _get_similar_move_lines(self):
|
||||
self.ensure_one()
|
||||
|
||||
@@ -671,7 +671,7 @@ class Picking(models.Model):
|
||||
def button_validate(self):
|
||||
self.ensure_one()
|
||||
if not self.move_lines and not self.move_line_ids:
|
||||
raise UserError(_('Please add some lines to move'))
|
||||
raise UserError(_('Please add some items to move.'))
|
||||
|
||||
# If no lots when needed, raise error
|
||||
picking_type = self.picking_type_id
|
||||
@@ -996,7 +996,7 @@ class Picking(models.Model):
|
||||
|
||||
operation_ids.write({'result_package_id': package.id})
|
||||
else:
|
||||
raise UserError(_('Please process some quantities to put in the pack first!'))
|
||||
raise UserError(_('You must first set the quantity you will put in the pack.'))
|
||||
return package
|
||||
|
||||
def put_in_pack(self):
|
||||
|
||||
@@ -34,7 +34,7 @@ class ProductionLot(models.Model):
|
||||
if active_picking_id:
|
||||
picking_id = self.env['stock.picking'].browse(active_picking_id)
|
||||
if picking_id and not picking_id.picking_type_id.use_create_lots:
|
||||
raise UserError(_("You are not allowed to create a lot for this picking type"))
|
||||
raise UserError(_("You are not allowed to create a lot for this operation type."))
|
||||
return super(ProductionLot, self).create(vals)
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -83,7 +83,7 @@ class StockQuant(models.Model):
|
||||
def check_in_date(self):
|
||||
for quant in self:
|
||||
if quant.in_date and not quant.lot_id:
|
||||
raise ValidationError(_('An incoming date cannot be set to an untracked product.'))
|
||||
raise ValidationError(_('An incoming date cannot be set on an untracked product.'))
|
||||
|
||||
@api.constrains('location_id')
|
||||
def check_location_id(self):
|
||||
@@ -419,7 +419,7 @@ class QuantPackage(models.Model):
|
||||
for pack in self:
|
||||
locations = pack.get_content().filtered(lambda quant: quant.qty > 0.0).mapped('location_id')
|
||||
if len(locations) != 1:
|
||||
raise UserError(_('Everything inside a package should be in the same location'))
|
||||
raise UserError(_('Every item inside a package should be in the same location.'))
|
||||
return True
|
||||
|
||||
def unpack(self):
|
||||
|
||||
@@ -140,7 +140,7 @@ class Warehouse(models.Model):
|
||||
|
||||
if 'default_resupply_wh_id' in vals:
|
||||
if vals.get('default_resupply_wh_id') and any(vals['default_resupply_wh_id'] == warehouse.id for warehouse in warehouses):
|
||||
raise UserError(_('The default resupply warehouse should be different than the warehouse itself!'))
|
||||
raise UserError(_('The default resupply warehouse should be different than itself.'))
|
||||
for warehouse in warehouses.filtered(lambda wh: wh.default_resupply_wh_id):
|
||||
# remove the existing resupplying route on the warehouse
|
||||
to_remove_routes = Route.search([('supplied_wh_id', '=', warehouse.id), ('supplier_wh_id', '=', warehouse.default_resupply_wh_id.id)])
|
||||
@@ -794,7 +794,7 @@ class Orderpoint(models.Model):
|
||||
def _check_product_uom(self):
|
||||
''' Check if the UoM has the same category as the product standard UoM '''
|
||||
if any(orderpoint.product_id.uom_id.category_id != orderpoint.product_uom.category_id for orderpoint in self):
|
||||
raise ValidationError(_('You have to select a product unit of measure in the same category than the default unit of measure of the product'))
|
||||
raise ValidationError(_('You have to select a product unit of measure that is in the same category than the default unit of measure of the product'))
|
||||
|
||||
@api.onchange('warehouse_id')
|
||||
def onchange_warehouse_id(self):
|
||||
|
||||
@@ -34,7 +34,7 @@ class ReturnPicking(models.TransientModel):
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
if len(self.env.context.get('active_ids', list())) > 1:
|
||||
raise UserError(_("You may only return one picking at a time!"))
|
||||
raise UserError(_("You may only return one picking at a time."))
|
||||
res = super(ReturnPicking, self).default_get(fields)
|
||||
|
||||
move_dest_exists = False
|
||||
@@ -43,7 +43,7 @@ class ReturnPicking(models.TransientModel):
|
||||
if picking:
|
||||
res.update({'picking_id': picking.id})
|
||||
if picking.state != 'done':
|
||||
raise UserError(_("You may only return Done pickings"))
|
||||
raise UserError(_("You may only return Done pickings."))
|
||||
for move in picking.move_lines:
|
||||
if move.scrapped:
|
||||
continue
|
||||
@@ -55,7 +55,7 @@ class ReturnPicking(models.TransientModel):
|
||||
product_return_moves.append((0, 0, {'product_id': move.product_id.id, 'quantity': quantity, 'move_id': move.id, 'uom_id': move.product_id.uom_id.id}))
|
||||
|
||||
if not product_return_moves:
|
||||
raise UserError(_("No products to return (only lines in Done state and not fully returned yet can be returned)!"))
|
||||
raise UserError(_("No products to return (only lines in Done state and not fully returned yet can be returned)."))
|
||||
if 'product_return_moves' in fields:
|
||||
res.update({'product_return_moves': product_return_moves})
|
||||
if 'move_dest_exists' in fields:
|
||||
@@ -108,7 +108,7 @@ class ReturnPicking(models.TransientModel):
|
||||
returned_lines = 0
|
||||
for return_line in self.product_return_moves:
|
||||
if not return_line.move_id:
|
||||
raise UserError(_("You have manually created product lines, please delete them to proceed"))
|
||||
raise UserError(_("You have manually created product lines, please delete them to proceed."))
|
||||
# TODO sle: float_is_zero?
|
||||
if return_line.quantity:
|
||||
returned_lines += 1
|
||||
|
||||
@@ -125,7 +125,7 @@ class ProductProduct(models.Model):
|
||||
for product in self.with_context(location=location.id, compute_child=False).filtered(lambda r: r.valuation == 'real_time'):
|
||||
diff = product.standard_price - new_price
|
||||
if float_is_zero(diff, precision_rounding=product.currency_id.rounding):
|
||||
raise UserError(_("No difference between standard price and new price!"))
|
||||
raise UserError(_("No difference between the standard price and the new price."))
|
||||
if not product_accounts[product.id].get('stock_valuation', False):
|
||||
raise UserError(_('You don\'t have any stock valuation account defined on your product category. You must define one before processing this operation.'))
|
||||
qty_available = product.qty_available
|
||||
|
||||
@@ -344,7 +344,7 @@ class StockMove(models.Model):
|
||||
# Apply restrictions on the stock move to be able to make
|
||||
# consistent accounting entries.
|
||||
if move._is_in() and move._is_out():
|
||||
raise UserError(_("The move lines are not in a consistent state: some are entering and other are leaving the company. "))
|
||||
raise UserError(_("The move lines are not in a consistent state: some are entering and other are leaving the company."))
|
||||
company_src = move.mapped('move_line_ids.location_id.company_id')
|
||||
company_dst = move.mapped('move_line_ids.location_dest_id.company_id')
|
||||
try:
|
||||
@@ -492,7 +492,7 @@ class StockMove(models.Model):
|
||||
if acc_valuation:
|
||||
acc_valuation = acc_valuation.id
|
||||
if not accounts_data.get('stock_journal', False):
|
||||
raise UserError(_('You don\'t have any stock journal defined on your product category, check if you have installed a chart of accounts'))
|
||||
raise UserError(_('You don\'t have any stock journal defined on your product category, check if you have installed a chart of accounts.'))
|
||||
if not acc_src:
|
||||
raise UserError(_('Cannot find a stock input account for the product %s. You must define one on the product category, or on the location, before processing this operation.') % (self.product_id.name))
|
||||
if not acc_dest:
|
||||
|
||||
@@ -74,7 +74,7 @@ class StockPickingBatch(models.Model):
|
||||
if (picking_type.use_create_lots or picking_type.use_existing_lots):
|
||||
for ml in picking.move_line_ids:
|
||||
if ml.product_id.tracking != 'none':
|
||||
raise UserError(_('Some products require lots/serial numbers, so you need to specify those first!'))
|
||||
raise UserError(_('Some products require lots/serial numbers.'))
|
||||
# Check if we need to set some qty done.
|
||||
picking_without_qty_done |= picking
|
||||
elif picking._check_backorder():
|
||||
|
||||
@@ -684,7 +684,7 @@ class SurveyLabel(models.Model):
|
||||
def _check_question_not_empty(self):
|
||||
"""Ensure that field question_id XOR field question_id_2 is not null"""
|
||||
if not bool(self.question_id) != bool(self.question_id_2):
|
||||
raise ValidationError(_("A label must be attached to one and only one question"))
|
||||
raise ValidationError(_("A label must be attached to only one question."))
|
||||
|
||||
|
||||
class SurveyUserInput(models.Model):
|
||||
@@ -803,7 +803,7 @@ class SurveyUserInputLine(models.Model):
|
||||
def _answered_or_skipped(self):
|
||||
for uil in self:
|
||||
if not uil.skipped != bool(uil.answer_type):
|
||||
raise ValidationError(_('A question cannot be unanswered and skipped'))
|
||||
raise ValidationError(_('This question cannot be unanswered or skipped.'))
|
||||
|
||||
@api.constrains('answer_type')
|
||||
def _check_answer_type(self):
|
||||
|
||||
@@ -91,7 +91,7 @@ var FieldTimezoneMismatch = FieldSelection.extend({
|
||||
if (this.mismatch){
|
||||
var $span = $('<span class="fa fa-exclamation-triangle o_tz_warning"/>');
|
||||
$span.insertAfter(this.$el);
|
||||
$span.attr('title', _t("Timezone Mismatch : The timezone of your browser doesn't match the selected one. The time in Odoo is displayed according to your field timezone."));
|
||||
$span.attr('title', _t("Timezone Mismatch : The timezone of your browser doesn't match the selected one. The time in Odoo is displayed according to the timezone set on your user's preferences."));
|
||||
this.$el = this.$el.add($span);
|
||||
|
||||
this.$option = this.$('option').filter(function () {
|
||||
|
||||
@@ -334,7 +334,7 @@ var ListRenderer = BasicRenderer.extend({
|
||||
var self = this;
|
||||
$button.on("click", function (e) {
|
||||
e.stopPropagation();
|
||||
self.do_warn(_t("Warning"), _t('Please click on the "save" button first'));
|
||||
self.do_warn(_t("Warning"), _t('Please click on the "save" button first.'));
|
||||
});
|
||||
} else {
|
||||
$button.prop('disabled', true);
|
||||
|
||||
@@ -75,7 +75,7 @@ class EventQuestion(models.Model):
|
||||
@api.constrains('event_type_id', 'event_id')
|
||||
def _constrains_event(self):
|
||||
if any(question.event_type_id and question.event_id for question in self):
|
||||
raise UserError(_('Question should belong to either event category or event but not both'))
|
||||
raise UserError(_('Question cannot belong to both the event category and itself.'))
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
|
||||
@@ -430,12 +430,12 @@ class Post(models.Model):
|
||||
post = super(Post, self.with_context(mail_create_nolog=True)).create(vals)
|
||||
# deleted or closed questions
|
||||
if post.parent_id and (post.parent_id.state == 'close' or post.parent_id.active is False):
|
||||
raise UserError(_('Posting answer on a [Deleted] or [Closed] question is not possible'))
|
||||
raise UserError(_('Posting answer on a [Deleted] or [Closed] question is not possible.'))
|
||||
# karma-based access
|
||||
if not post.parent_id and not post.can_ask:
|
||||
raise KarmaError('Not enough karma to create a new question')
|
||||
raise KarmaError('You don\'t have enough karma to create a new question.')
|
||||
elif post.parent_id and not post.can_answer:
|
||||
raise KarmaError('Not enough karma to answer to a question')
|
||||
raise KarmaError('You don\'t have enough karma to answer a question.')
|
||||
if not post.parent_id and not post.can_post:
|
||||
post.sudo().state = 'pending'
|
||||
|
||||
@@ -874,12 +874,12 @@ class Vote(models.Model):
|
||||
|
||||
# own post check
|
||||
if vote.user_id.id == vote.post_id.create_uid.id:
|
||||
raise UserError(_('Not allowed to vote for its own post'))
|
||||
raise UserError(_('It is not allowed to vote for its own post.'))
|
||||
# karma check
|
||||
if vote.vote == '1' and not vote.post_id.can_upvote:
|
||||
raise KarmaError('Not enough karma to upvote.')
|
||||
raise KarmaError('You don\'t have enough karma toupvote.')
|
||||
elif vote.vote == '-1' and not vote.post_id.can_downvote:
|
||||
raise KarmaError('Not enough karma to downvote.')
|
||||
raise KarmaError('You don\'t have enough karma to downvote.')
|
||||
|
||||
if vote.post_id.parent_id:
|
||||
karma_value = self._get_karma_value('0', vote.vote, vote.forum_id.karma_gen_answer_upvote, vote.forum_id.karma_gen_answer_downvote)
|
||||
@@ -894,12 +894,12 @@ class Vote(models.Model):
|
||||
for vote in self:
|
||||
# own post check
|
||||
if vote.user_id.id == vote.post_id.create_uid.id:
|
||||
raise UserError(_('Not allowed to vote for its own post'))
|
||||
raise UserError(_('It is not allowed to vote for its own post.'))
|
||||
# karma check
|
||||
if (values['vote'] == '1' or vote.vote == '-1' and values['vote'] == '0') and not vote.post_id.can_upvote:
|
||||
raise KarmaError('Not enough karma to upvote.')
|
||||
raise KarmaError('You don\'t have enough karma to upvote.')
|
||||
elif (values['vote'] == '-1' or vote.vote == '1' and values['vote'] == '0') and not vote.post_id.can_downvote:
|
||||
raise KarmaError('Not enough karma to downvote.')
|
||||
raise KarmaError('You don\'t have enough karma to downvote.')
|
||||
|
||||
# karma update
|
||||
if vote.post_id.parent_id:
|
||||
@@ -938,5 +938,5 @@ class Tags(models.Model):
|
||||
def create(self, vals):
|
||||
forum = self.env['forum.forum'].browse(vals.get('forum_id'))
|
||||
if self.env.user.karma < forum.karma_tag_create:
|
||||
raise KarmaError(_('Not enough karma to create a new Tag'))
|
||||
raise KarmaError(_('You don\'t have enough karma to create a new Tag.'))
|
||||
return super(Tags, self.with_context(mail_create_nolog=True, mail_create_nosubscribe=True)).create(vals)
|
||||
|
||||
@@ -33,7 +33,7 @@ class Documentation(models.Model):
|
||||
@api.constrains('parent_id')
|
||||
def _check_parent_id(self):
|
||||
if not self._check_recursion():
|
||||
raise ValidationError(_('Error ! You cannot create recursive categories.'))
|
||||
raise ValidationError(_('You cannot create recursive categories.'))
|
||||
|
||||
|
||||
class DocumentationStage(models.Model):
|
||||
|
||||
@@ -154,7 +154,7 @@ class SaleOrder(models.Model):
|
||||
order_line = False
|
||||
if self.state != 'draft':
|
||||
request.session['sale_order_id'] = None
|
||||
raise UserError(_('It is forbidden to modify a sales order which is not in draft status'))
|
||||
raise UserError(_('It is forbidden to modify a sales order which is not in draft status.'))
|
||||
if line_id is not False:
|
||||
order_lines = self._cart_find_product_line(product_id, line_id, **kwargs)
|
||||
order_line = order_lines and order_lines[0]
|
||||
|
||||
@@ -177,7 +177,7 @@ class IrModel(models.Model):
|
||||
if not self._context.get(MODULE_UNINSTALL_FLAG):
|
||||
for model in self:
|
||||
if model.state != 'manual':
|
||||
raise UserError(_("Model '%s' contains module data and cannot be removed!") % model.name)
|
||||
raise UserError(_("Model '%s' contains module data and cannot be removed.") % model.name)
|
||||
# prevent screwing up fields that depend on these models' fields
|
||||
model.field_id._prepare_update()
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ class Module(models.Model):
|
||||
return True
|
||||
for module in self:
|
||||
if module.state in ('installed', 'to upgrade', 'to remove', 'to install'):
|
||||
raise UserError(_('You try to remove a module that is installed or will be installed'))
|
||||
raise UserError(_('You are trying to remove a module that is installed or will be installed.'))
|
||||
self.clear_caches()
|
||||
return super(Module, self).unlink()
|
||||
|
||||
|
||||
@@ -65,4 +65,4 @@ class report_paperformat(models.Model):
|
||||
@api.constrains('format')
|
||||
def _check_format_or_page(self):
|
||||
if self.filtered(lambda x: x.format != 'custom' and (x.page_width or x.page_height)):
|
||||
raise ValidationError(_('Error ! You cannot select a format AND specific page width/height.'))
|
||||
raise ValidationError(_('You can select either a format or a specific page width/height, but not both.'))
|
||||
|
||||
@@ -242,7 +242,7 @@ class Company(models.Model):
|
||||
@api.constrains('parent_id')
|
||||
def _check_parent_id(self):
|
||||
if not self._check_recursion():
|
||||
raise ValidationError(_('Error ! You cannot create recursive companies.'))
|
||||
raise ValidationError(_('You cannot create recursive companies.'))
|
||||
|
||||
@api.multi
|
||||
def open_company_edit_report(self):
|
||||
|
||||
@@ -225,7 +225,7 @@ class Lang(models.Model):
|
||||
raise UserError(_("Language code cannot be modified."))
|
||||
if vals.get('active') == False:
|
||||
if self.env['res.users'].search([('lang', 'in', lang_codes)]):
|
||||
raise UserError(_("Cannot unactivate a language that is currently used by users."))
|
||||
raise UserError(_("Cannot deactivate a language that is currently used by users."))
|
||||
# delete linked ir.default specifying default partner's language
|
||||
self.env['ir.default'].discard_values('res.partner', 'lang', lang_codes)
|
||||
|
||||
@@ -237,10 +237,10 @@ class Lang(models.Model):
|
||||
def unlink(self):
|
||||
for language in self:
|
||||
if language.code == 'en_US':
|
||||
raise UserError(_("Base Language 'en_US' can not be deleted!"))
|
||||
raise UserError(_("Base Language 'en_US' can not be deleted."))
|
||||
ctx_lang = self._context.get('lang')
|
||||
if ctx_lang and (language.code == ctx_lang):
|
||||
raise UserError(_("You cannot delete the language which is User's Preferred Language!"))
|
||||
raise UserError(_("You cannot delete the language which is the user's preferred language."))
|
||||
if language.active:
|
||||
raise UserError(_("You cannot delete the language which is Active!\nPlease de-activate the language first."))
|
||||
self.env['ir.translation'].search([('lang', '=', language.code)]).unlink()
|
||||
|
||||
@@ -81,7 +81,7 @@ class PartnerCategory(models.Model):
|
||||
@api.constrains('parent_id')
|
||||
def _check_parent_id(self):
|
||||
if not self._check_recursion():
|
||||
raise ValidationError(_('Error ! You can not create recursive tags.'))
|
||||
raise ValidationError(_('You can not create recursive tags.'))
|
||||
|
||||
@api.multi
|
||||
def name_get(self):
|
||||
|
||||
@@ -361,7 +361,7 @@ class MergePartnerAutomatic(models.TransientModel):
|
||||
groups.append(field_name[len(group_by_prefix):])
|
||||
|
||||
if not groups:
|
||||
raise UserError(_("You have to specify a filter for your selection"))
|
||||
raise UserError(_("You have to specify a filter for your selection."))
|
||||
|
||||
return groups
|
||||
|
||||
|
||||
Reference in New Issue
Block a user