Impacted modules:
hr, hr_contract, hr_recruitment, hr_payroll, fleet, hr_skills, hr_appraisal, ....
Several onchanges have been converted to computed fields in the following modules :
Community :
- hr
- hr_contract
- hr_recruitment
- hr_work_entry
- hr_maintenance
- hr_expense
- hr_expense_check
- hr_holidays
- sale_expense
- account_analytic_default_hr_expense
Enterprise:
- hr_contract_salary
- hr_referral
- hr_payroll
- hr_payroll_expense
- test_l10n_be_hr_payroll_account
There are still 2 onchanges with complex behavior that couldn't be converted easily:
- an onchange that updates "tz" (timezone) that is defined as a related field
to "resource_id.tz". Apparently it is useless except to initialize the default
value of "tz".
- an onchange that updates "name" that is defined as a related field to
"resource_id.name".
the applicant.
closes odoo/odoo#45414
Taskid: 2169099
Related: odoo/enterprise#8572
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
41 lines
2.0 KiB
Python
41 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from odoo import models, fields, api
|
|
|
|
|
|
class HrExpenseRegisterPaymentWizard(models.TransientModel):
|
|
_inherit = "hr.expense.sheet.register.payment.wizard"
|
|
|
|
check_amount_in_words = fields.Char(string="Amount in Words", compute='_compute_check_amount_in_words', store=True, readonly=False)
|
|
check_manual_sequencing = fields.Boolean(related='journal_id.check_manual_sequencing', readonly=False)
|
|
# Note: a check_number == 0 means that it will be attributed when the check is printed
|
|
check_number = fields.Char(string="Check Number", compute='_compute_check_number', store=True, copy=False,
|
|
help="Number of the check corresponding to this payment. If your pre-printed check are not already numbered, "
|
|
"you can manage the numbering in the journal configuration page.")
|
|
payment_method_code_2 = fields.Char(related='payment_method_id.code',
|
|
help="Technical field used to adapt the interface to the payment type selected.",
|
|
string="Payment Method Code 2",
|
|
readonly=True)
|
|
|
|
@api.depends('journal_id')
|
|
def _compute_check_number(self):
|
|
for wizard in self:
|
|
if wizard.journal_id.check_manual_sequencing:
|
|
wizard.check_number = wizard.journal_id.check_sequence_id.number_next_actual
|
|
else:
|
|
wizard.check_number = 0
|
|
|
|
@api.depends('amount')
|
|
def _compute_check_amount_in_words(self):
|
|
for wizard in self:
|
|
wizard.check_amount_in_words = wizard.currency_id.amount_to_text(wizard.amount)
|
|
|
|
def _get_payment_vals(self):
|
|
res = super(HrExpenseRegisterPaymentWizard, self)._get_payment_vals()
|
|
if self.payment_method_id == self.env.ref('account_check_printing.account_payment_method_check'):
|
|
res.update({
|
|
'check_amount_in_words': self.check_amount_in_words,
|
|
'check_manual_sequencing': self.check_manual_sequencing,
|
|
})
|
|
return res
|