commit
ef37728a8a
|
|
@ -2048,3 +2048,20 @@ msgstr "الشركة"
|
|||
msgid "Employee Number"
|
||||
msgstr "رقم الموظف"
|
||||
|
||||
#. module: attendences
|
||||
#: model_terms:ir.ui.view,arch_db:attendances.resource_calendar_inherited_form
|
||||
msgid "Overtime Accounts Settings"
|
||||
msgstr "إعداد الحسابات"
|
||||
|
||||
#. module: attendences
|
||||
#: model:ir.model.fields,field_description:hr_base.field_resource_calendar__journal_overtime_id
|
||||
#: model_terms:ir.ui.view,arch_db:attendances.resource_calendar_inherited_form
|
||||
msgid "Journal Overtime"
|
||||
msgstr "دفتر اليومية"
|
||||
|
||||
#. module: attendences
|
||||
#: model:ir.model.fields,field_description:hr_base.field_resource_calendar__account_overtime_id
|
||||
#: model_terms:ir.ui.view,arch_db:attendances.resource_calendar_inherited_form
|
||||
msgid "Account Overtime"
|
||||
msgstr "حساب الصرف"
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,10 @@
|
|||
<field name="overtime_factor_holiday"/>
|
||||
<field name="max_overtime_hour"/>
|
||||
</group>
|
||||
<group string="Overtime Accounts Settings" >
|
||||
<field name="journal_overtime_id" string="Journal Overtime"/>
|
||||
<field name="account_overtime_id" string="Account Overtime"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Permission Settings" name="over_time_full">
|
||||
<group>
|
||||
|
|
|
|||
|
|
@ -59,6 +59,13 @@ class employee_overtime_request(models.Model):
|
|||
if self.employee_id:
|
||||
self.department_id = self.employee_id.department_id.id
|
||||
|
||||
#get account and journal from setting
|
||||
@api.onchange('transfer_type','employee_id')
|
||||
def get_account_ids(self):
|
||||
if self.transfer_type == 'accounting':
|
||||
self.journal_id = self.employee_id.contract_id.working_hours.journal_overtime_id
|
||||
self.account_id = self.employee_id.contract_id.working_hours.account_overtime_id
|
||||
|
||||
@api.onchange('transfer_type', 'account_id', 'journal_id', 'line_ids_over_time')
|
||||
def onchange_transfer_type(self):
|
||||
if self.transfer_type == 'payroll':
|
||||
|
|
@ -74,9 +81,9 @@ class employee_overtime_request(models.Model):
|
|||
line.account_id = self.account_id
|
||||
if not line.journal_id:
|
||||
line.journal_id = self.journal_id
|
||||
else:
|
||||
line.account_id = False
|
||||
line.journal_id = False
|
||||
#else:
|
||||
# line.account_id = False
|
||||
# line.journal_id = False
|
||||
|
||||
@api.onchange('account_id')
|
||||
def onchange_account_id(self):
|
||||
|
|
@ -113,22 +120,22 @@ class employee_overtime_request(models.Model):
|
|||
record.write({
|
||||
'move_id': False
|
||||
})
|
||||
record.account_id = False
|
||||
record.journal_id = False
|
||||
#record.account_id = False
|
||||
#record.journal_id = False
|
||||
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_over_time:
|
||||
record.write({
|
||||
'move_id': False,
|
||||
'account_id': False,
|
||||
'journal_id': False
|
||||
#'account_id': False,
|
||||
#'journal_id': False
|
||||
})
|
||||
|
||||
def submit(self):
|
||||
|
|
@ -163,18 +170,18 @@ class employee_overtime_request(models.Model):
|
|||
debit_line_vals = {
|
||||
'name': record.employee_id.name,
|
||||
'debit': record.price_hour,
|
||||
'account_id': record.account_id.id,
|
||||
'account_id': item.account_id.id,
|
||||
'partner_id': record.employee_id.user_id.partner_id.id
|
||||
}
|
||||
credit_line_vals = {
|
||||
'name': record.employee_id.name,
|
||||
'credit': record.price_hour,
|
||||
'account_id': record.journal_id.default_account_id.id,
|
||||
'account_id': item.journal_id.default_account_id.id,
|
||||
'partner_id': record.employee_id.user_id.partner_id.id
|
||||
}
|
||||
move = record.env['account.move'].create({
|
||||
'state': 'draft',
|
||||
'journal_id': record.journal_id.id,
|
||||
'journal_id': item.journal_id.id,
|
||||
'date': item.request_date,
|
||||
'ref': record.employee_id.name,
|
||||
'line_ids': [(0, 0, debit_line_vals), (0, 0, credit_line_vals)]
|
||||
|
|
|
|||
|
|
@ -83,10 +83,12 @@
|
|||
<field name="overtime_plase" string="Overtime Plase" attrs="{'readonly':[('state','!=','draft')]}" required="1"/>
|
||||
<field name="reason" string="Reason" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="exception" groups="hr_base.group_executive_manager,hr.group_hr_user" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="account_id" string="Account"
|
||||
attrs="{'invisible':['|',('transfer_type','!=','accounting'),('state','!=','hr_aaproval')], 'readonly':[('state','!=','hr_aaproval')], 'required': [('state', '=', 'hr_aaproval'),('transfer_type','=','accounting')]}"/>
|
||||
|
||||
<field name="journal_id" string="Journal"
|
||||
attrs="{'invisible':['|',('transfer_type','!=','accounting'),('state','!=','hr_aaproval')], 'readonly':[('state','!=','hr_aaproval')], 'required': [('state', '=', 'hr_aaproval'),('transfer_type','=','accounting')]}"/>
|
||||
attrs="{'invisible':[('transfer_type','!=','accounting')], 'readonly':[('state','!=','executive_office')], 'required': [('state', '=', 'executive_office'),('transfer_type','=','accounting')]}" force_save="1"/>
|
||||
<field name="account_id" string="Account"
|
||||
attrs="{'invisible':[('transfer_type','!=','accounting')], 'readonly':[('state','!=','executive_office')], 'required': [('state', '=', 'executive_office'),('transfer_type','=','accounting')]}" force_save="1"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<separator string="Employees Over Time"/>
|
||||
|
|
@ -96,9 +98,9 @@
|
|||
<field name="employee_id"/>
|
||||
<field name="transfer_type" invisible='1' string="Transfer Type"/>
|
||||
<field name="account_id" string="Account" groups="hr_base.group_account_manager" force_save="1" readonly="1"
|
||||
attrs="{'invisible':[('transfer_type','!=','accounting')]}"/>
|
||||
attrs="{'invisible':[('transfer_type','!=','accounting')]}" invisible='1'/>
|
||||
<field name="journal_id" string="Journal" groups="hr_base.group_account_manager" force_save="1" readonly="1"
|
||||
attrs="{'invisible':[('transfer_type','!=','accounting')]}"/>
|
||||
attrs="{'invisible':[('transfer_type','!=','accounting')]}" invisible='1'/>
|
||||
<!--field name="calculate_from_total" groups="hr.group_hr_user"/-->
|
||||
<field name="exception" readonly="1" invisible='1'/>
|
||||
<field name="remaining_hours" force_save="1" readonly="1"/>
|
||||
|
|
|
|||
|
|
@ -802,6 +802,9 @@ class HrAttendances(models.Model):
|
|||
overtime_factor_holiday = fields.Float(string="Overtime Factor Holiday")
|
||||
max_overtime_hour = fields.Integer()
|
||||
|
||||
journal_overtime_id = fields.Many2one('account.journal',domain=[('type', '=', 'general')])
|
||||
account_overtime_id = fields.Many2one('account.account')
|
||||
|
||||
|
||||
class HrQualificationName(models.Model):
|
||||
_name = "hr.qualification.name"
|
||||
|
|
|
|||
Loading…
Reference in New Issue