diff --git a/hr_custody/models/custody.py b/hr_custody/models/custody.py index 18601aa7..b1347ecf 100644 --- a/hr_custody/models/custody.py +++ b/hr_custody/models/custody.py @@ -121,7 +121,7 @@ def set_to_return(self): @api.constrains('return_date') def validate_return_date(self): if self.return_date < self.date_request: - raise Warning('Please Give Valid Return Date') + raise Warning(_('Please Give Valid Return Date')) name = fields.Char(string='Code', copy=False) company_id = fields.Many2one('res.company', 'Company', readonly=True, @@ -197,7 +197,7 @@ def validate_return_date(self): context = self._context custody_obj = self.env['hr.custody'].search([('id', '=', context.get('custody_id'))]) if self.returned_date <= custody_obj.date_request: - raise Warning('Please Give Valid Renewal Date') + raise Warning(_('Please Give Valid Renewal Date')) @api.multi def proceed(self): diff --git a/ohrms_loan/models/hr_loan.py b/ohrms_loan/models/hr_loan.py index be8d8e56..b49867c3 100644 --- a/ohrms_loan/models/hr_loan.py +++ b/ohrms_loan/models/hr_loan.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from odoo import models, fields, api,_ +from odoo import models, fields, api, _ from datetime import datetime from dateutil.relativedelta import relativedelta from odoo.exceptions import ValidationError, UserError @@ -100,7 +100,7 @@ def unlink(self): for loan in self: if loan.state not in ('draft', 'cancel'): raise UserError( - 'You cannot delete a loan which is not in draft or cancelled state') + _('You cannot delete a loan which is not in draft or cancelled state')) return super(HrLoan, self).unlink() @api.multi diff --git a/ohrms_loan_accounting/models/hr_loan_acc.py b/ohrms_loan_accounting/models/hr_loan_acc.py index 60bb1f47..b4169e2b 100644 --- a/ohrms_loan_accounting/models/hr_loan_acc.py +++ b/ohrms_loan_accounting/models/hr_loan_acc.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import time -from odoo import models, api +from odoo import models, api, _ from odoo.exceptions import UserError @@ -14,16 +14,16 @@ def action_approve(self): loan_approve = self.env['ir.config_parameter'].sudo().get_param('account.loan_approve') contract_obj = self.env['hr.contract'].search([('employee_id', '=', self.employee_id.id)]) if not contract_obj: - raise UserError('You must Define a contract for employee') + raise UserError(_('You must Define a contract for employee')) if not self.loan_lines: - raise UserError('You must compute installment before Approved') + raise UserError(_('You must compute installment before Approved')) if loan_approve: self.write({'state': 'waiting_approval_2'}) else: if not self.emp_account_id or not self.treasury_account_id or not self.journal_id: - raise UserError("You must enter employee account & Treasury account and journal to approve ") + raise UserError(_("You must enter employee account & Treasury account and journal to approve ")) if not self.loan_lines: - raise UserError('You must compute Loan Request before Approved') + raise UserError(_('You must compute Loan Request before Approved')) timenow = time.strftime('%Y-%m-%d') for loan in self: amount = loan.loan_amount @@ -68,9 +68,9 @@ def action_double_approve(self): """This create account move for request in case of double approval. """ if not self.emp_account_id or not self.treasury_account_id or not self.journal_id: - raise UserError("You must enter employee account & Treasury account and journal to approve ") + raise UserError(_("You must enter employee account & Treasury account and journal to approve ")) if not self.loan_lines: - raise UserError('You must compute Loan Request before Approved') + raise UserError(_('You must compute Loan Request before Approved')) timenow = time.strftime('%Y-%m-%d') for loan in self: amount = loan.loan_amount @@ -121,7 +121,7 @@ def action_paid_amount(self): timenow = time.strftime('%Y-%m-%d') for line in self: if line.loan_id.state != 'approve': - raise UserError("Loan Request must be approved") + raise UserError(_("Loan Request must be approved")) amount = line.amount loan_name = line.employee_id.name reference = line.loan_id.name