commit
327e1ce62a
|
|
@ -15,6 +15,7 @@ class HrOfficialMission(models.Model):
|
|||
_rec_name = 'mission_type'
|
||||
_description = 'Official mission'
|
||||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_order = 'date_from desc'
|
||||
|
||||
date = fields.Date(default=lambda self: fields.Date.today())
|
||||
date_from = fields.Date()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class EmployeeReward(models.Model):
|
|||
percentage = fields.Float(string="Percentage%", default=100)
|
||||
amount = fields.Float(string="Amount")
|
||||
account_id = fields.Many2one('account.account')
|
||||
journal_id = fields.Many2one('account.journal', string='Payment Method', domain=[('type', 'in', ('bank', 'cash'))])
|
||||
journal_id = fields.Many2one('account.journal', string='Payment Method')
|
||||
next_approve = fields.Text(string="Next Required Approval", compute="_get_nxt_approve")
|
||||
reward_type = fields.Selection(
|
||||
[('allowance', 'Allowance'), ('amount', 'Amount')], default='allowance')
|
||||
|
|
@ -121,19 +121,20 @@ class EmployeeReward(models.Model):
|
|||
debit_line_vals = {
|
||||
'name': record.employee_id.name,
|
||||
'debit': record.amount,
|
||||
'account_id': record.account_id.id,
|
||||
'partner_id': record.employee_id.user_id.partner_id.id
|
||||
'account_id': item.account_id.id,
|
||||
'partner_id': record.employee_id.user_id.partner_id.id,
|
||||
'analytic_account_id': record.employee_id.department_id.analytic_account_id.id
|
||||
}
|
||||
credit_line_vals = {
|
||||
'name': record.employee_id.name,
|
||||
'credit': record.amount,
|
||||
'account_id': record.journal_id.default_account_id.id,
|
||||
'partner_id': record.employee_id.user_id.partner_id.id
|
||||
'account_id': item.journal_id.default_account_id.id
|
||||
#'partner_id': record.employee_id.user_id.partner_id.id
|
||||
}
|
||||
if not record.move_id:
|
||||
move = record.env['account.move'].create({
|
||||
'state': 'draft',
|
||||
'journal_id': record.journal_id.id,
|
||||
'journal_id': item.journal_id.id,
|
||||
'date': item.date,
|
||||
'ref': record.employee_id.name,
|
||||
'line_ids': [(0, 0, debit_line_vals), (0, 0, credit_line_vals)],
|
||||
|
|
@ -205,23 +206,23 @@ class EmployeeReward(models.Model):
|
|||
# record.move_id.write({'state': 'canceled'})
|
||||
record.move_id.unlink()
|
||||
record.write({'move_id': False, })
|
||||
record.account_id = False
|
||||
record.journal_id = False
|
||||
#record.account_id = False
|
||||
#record.journal_id = False
|
||||
record.reward_state = "draft"
|
||||
self.write({'state': 'draft'})
|
||||
self.account_id = False
|
||||
self.journal_id = False
|
||||
#self.account_id = False
|
||||
#self.journal_id = False
|
||||
else:
|
||||
self.write({
|
||||
'state': 'draft',
|
||||
'account_id': False,
|
||||
'journal_id': False
|
||||
#'account_id': False,
|
||||
#'journal_id': False
|
||||
})
|
||||
for record in self.line_ids_reward:
|
||||
record.write({
|
||||
'move_id': False,
|
||||
'account_id': False,
|
||||
'journal_id': False,
|
||||
#'account_id': False,
|
||||
#'journal_id': False,
|
||||
'reward_state': 'draft'
|
||||
})
|
||||
|
||||
|
|
@ -275,7 +276,7 @@ class HrEmployee(models.Model):
|
|||
domain=lambda self: self._domain_get_employee())
|
||||
amount = fields.Float(string="Amount", compute='_compute_calculate_amount', store=True)
|
||||
account_id = fields.Many2one('account.account', string='Account')
|
||||
journal_id = fields.Many2one('account.journal', string='Payment Method', domain=[('type', 'in', ('bank', 'cash'))])
|
||||
journal_id = fields.Many2one('account.journal', string='Payment Method')
|
||||
percentage = fields.Float(string="Percentage%")
|
||||
move_id = fields.Many2one('account.move')
|
||||
contract_advantage_id = fields.Many2one('hr.contract')
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@
|
|||
'required': [('reward_type', '=', 'allowance')]}"/>
|
||||
|
||||
|
||||
<field name="account_id" string="Account" attrs="{'invisible':['|',('transfer_type','!=','accounting'),('state', '!=', 'hrm')],
|
||||
<field name="account_id" string="Account" attrs="{'invisible':[('transfer_type','!=','accounting')],
|
||||
'readonly':[('state','!=','hrm')], 'required': [('transfer_type', '=', 'accounting'),('state', '=', 'hrm')]}"/>
|
||||
<field name="journal_id" string="Journal" attrs="{'invisible':['|',('transfer_type','!=','accounting'),('state', '!=', 'hrm')],
|
||||
<field name="journal_id" string="Journal" attrs="{'invisible':[('transfer_type','!=','accounting')],
|
||||
'readonly':[('state','!=','hrm')], 'required': [('transfer_type', '=', 'accounting'),('state', '=', 'hrm')]}"/>
|
||||
<field name="benefits_discounts" attrs="{'invisible':[('transfer_type','!=','payroll')], 'readonly':[('state','!=','submitted')],
|
||||
'required': [('transfer_type', '=', 'payroll'),('state','=','submitted')]}"/>
|
||||
|
|
@ -90,12 +90,12 @@
|
|||
attrs="{'readonly':['|','|',('state','=','submitted'),('state','=','done'),('state','=','refused')], 'required': [('state', '=', 'hrm')]}">
|
||||
<tree string="Employee Reward and Allowances" editable="bottom">
|
||||
<field name="employee_id"/>
|
||||
<field name="account_id" string="Account"
|
||||
<!--field name="account_id" string="Account"
|
||||
groups="hr_base.group_executive_manager,hr.group_hr_user"
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')],'invisible':[('parent.transfer_type','!=','accounting')]}"/>
|
||||
<field name="journal_id" string="Journal"
|
||||
groups="hr_base.group_executive_manager,hr.group_hr_user"
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')],'invisible':[('parent.transfer_type','!=','accounting')]}"/>
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')],'invisible':[('parent.transfer_type','!=','accounting')]}"/-->
|
||||
<field name="amount" groups="hr_base.group_executive_manager,hr.group_hr_user"/>
|
||||
<field name="percentage"/>
|
||||
<field name="reward_state" invisible="1"/>
|
||||
|
|
|
|||
|
|
@ -25,12 +25,13 @@
|
|||
force_save="1"
|
||||
attrs="{'column_invisible':[('parent.reward_type','!=','allowance')]}" sum="Totals"/>
|
||||
<field name="amount" groups="hr_base.group_executive_manager,hr.group_hr_user" sum="Totals"/>
|
||||
<field name="account_id" string="Account"
|
||||
<!--field name="account_id" string="Account"
|
||||
groups="hr_base.group_executive_manager,hr.group_hr_user"
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')]}"/>
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')],'column_invisible':[('parent.transfer_type','!=','accounting')]}"/>
|
||||
<field name="journal_id" string="Journal"
|
||||
groups="hr_base.group_executive_manager,hr.group_hr_user"
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')]}"/>
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')],'column_invisible':[('parent.transfer_type','!=','accounting')]}"/-->
|
||||
<field name="move_id" attrs="{'readonly':[('reward_state','!=','draft')],'column_invisible':[('parent.transfer_type','!=','accounting')]}"/>
|
||||
<field name="due_loan"
|
||||
readonly="1"
|
||||
force_save="1"
|
||||
|
|
@ -42,12 +43,12 @@
|
|||
<form string="Employee Reward and Allowances">
|
||||
<group>
|
||||
<field name="employee_id"/>
|
||||
<field name="account_id" string="Account"
|
||||
<!--field name="account_id" string="Account"
|
||||
groups="hr_base.group_executive_manager,hr.group_hr_user"
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')]}"/>
|
||||
<field name="journal_id" string="Journal"
|
||||
groups="hr_base.group_executive_manager,hr.group_hr_user"
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')]}"/>
|
||||
attrs="{'readonly':[('reward_state','!=','hrm')]}"/-->
|
||||
<field name="move_id" string='Journal Move'/>
|
||||
<field name="check_appraisal"/>
|
||||
<field name="percentage"/>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class HrTermination(models.Model):
|
|||
_inherit = ['mail.thread', 'mail.activity.mixin']
|
||||
_rec_name = 'employee_id'
|
||||
_description = 'Termination'
|
||||
_order = 'last_work_date asc'
|
||||
|
||||
# default compute function
|
||||
def _get_employee_id(self):
|
||||
|
|
@ -436,7 +437,7 @@ class HrTermination(models.Model):
|
|||
self.allowance_deduction_ids = False
|
||||
rule_line = self.env['hr.salary.rule.line'].search([('allowance_deduction_inverse_id', '=', False)])
|
||||
if rule_line:
|
||||
rule_line.unlink()
|
||||
rule_line.sudo().unlink()
|
||||
|
||||
# Get all advantages from contract
|
||||
if self.sudo().contract_id:
|
||||
|
|
|
|||
Loading…
Reference in New Issue