commit
22c2cbb85a
|
|
@ -0,0 +1,92 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * attendance_custom_widget
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-10-31 10:53+0000\n"
|
||||
"PO-Revision-Date: 2024-10-31 10:53+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#: model:ir.model.fields,field_description:attendance_custom_widget.field_hr_employee__attendance_state
|
||||
#: model:ir.model.fields,field_description:attendance_custom_widget.field_hr_employee_base__attendance_state
|
||||
#: model:ir.model.fields,field_description:attendance_custom_widget.field_hr_employee_public__attendance_state
|
||||
msgid "Attendance Status"
|
||||
msgstr "حالة الحضور"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#: model:ir.model,name:attendance_custom_widget.model_hr_employee_base
|
||||
msgid "Basic Employee"
|
||||
msgstr "الموظف الأساسي"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#: model:ir.model.fields.selection,name:attendance_custom_widget.selection__hr_employee__attendance_state__checked_in
|
||||
#: model:ir.model.fields.selection,name:attendance_custom_widget.selection__hr_employee_base__attendance_state__checked_in
|
||||
#: model:ir.model.fields.selection,name:attendance_custom_widget.selection__hr_employee_public__attendance_state__checked_in
|
||||
msgid "Checked in"
|
||||
msgstr "تم تسجيل الحضور"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#: model:ir.model.fields.selection,name:attendance_custom_widget.selection__hr_employee__attendance_state__checked_out
|
||||
#: model:ir.model.fields.selection,name:attendance_custom_widget.selection__hr_employee_base__attendance_state__checked_out
|
||||
#: model:ir.model.fields.selection,name:attendance_custom_widget.selection__hr_employee_public__attendance_state__checked_out
|
||||
msgid "Checked out"
|
||||
msgstr "تم تسجيل الخروج"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#: model:ir.model.fields,field_description:attendance_custom_widget.field_hr_employee__display_name
|
||||
#: model:ir.model.fields,field_description:attendance_custom_widget.field_hr_employee_base__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "الاسم المعروض"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#: model:ir.model,name:attendance_custom_widget.model_hr_employee
|
||||
msgid "Employee"
|
||||
msgstr "الموظف"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#: model:ir.model.fields,field_description:attendance_custom_widget.field_hr_employee__id
|
||||
#: model:ir.model.fields,field_description:attendance_custom_widget.field_hr_employee_base__id
|
||||
msgid "ID"
|
||||
msgstr "المُعرف"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#: model:ir.model.fields,field_description:attendance_custom_widget.field_hr_employee____last_update
|
||||
#: model:ir.model.fields,field_description:attendance_custom_widget.field_hr_employee_base____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "آخر تعديل في"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#: code:addons/attendance_custom_widget/models/hr_employee.py:0
|
||||
#, python-format
|
||||
msgid "Wrong PIN"
|
||||
msgstr ""
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#. openerp-web
|
||||
#: code:addons/attendance_custom_widget/static/src/xml/attendance.xml:0
|
||||
#, python-format
|
||||
msgid "Default"
|
||||
msgstr "الإفتراضي"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#. openerp-web
|
||||
#: code:addons/attendance_custom_widget/static/src/xml/attendance.xml:0
|
||||
#, python-format
|
||||
msgid "Sign In"
|
||||
msgstr "تسجيل الدخول"
|
||||
|
||||
#. module: attendance_custom_widget
|
||||
#. openerp-web
|
||||
#: code:addons/attendance_custom_widget/static/src/xml/attendance.xml:0
|
||||
#, python-format
|
||||
msgid "Sign Out"
|
||||
msgstr "تسجيل الخروج"
|
||||
|
|
@ -161,7 +161,7 @@
|
|||
<tr>
|
||||
<td>الراتب الأساسي</td>
|
||||
<td colspan="2">
|
||||
<span t-field="doc.employee_id.contract_id.salary"/>
|
||||
<span t-esc="round(doc.employee_id.contract_id.salary,2)"/>
|
||||
<span>ريال</span>
|
||||
</td>
|
||||
<td>Basic Salary</td>
|
||||
|
|
@ -170,7 +170,7 @@
|
|||
<tr>
|
||||
<td>بدل السكن</td>
|
||||
<td colspan="2">
|
||||
<span t-field="doc.employee_id.contract_id.house_allowance_temp"/>
|
||||
<span t-esc="round(doc.employee_id.contract_id.house_allowance_temp,2)"/>
|
||||
<span>ريال</span>
|
||||
</td>
|
||||
<td>Housing Allowance</td>
|
||||
|
|
@ -179,7 +179,7 @@
|
|||
<tr>
|
||||
<td>بدل النقل</td>
|
||||
<td colspan="2">
|
||||
<span t-field="doc.employee_id.contract_id.transport_allowance"/>
|
||||
<span t-esc="round(doc.employee_id.contract_id.transport_allowance,2)"/>
|
||||
<span>ريال</span>
|
||||
</td>
|
||||
<td>Transportation Allowance</td>
|
||||
|
|
@ -188,7 +188,7 @@
|
|||
<tr>
|
||||
<td>الراتب الشهري الإجمالي</td>
|
||||
<td colspan="2">
|
||||
<span t-esc="doc.employee_id.contract_id.salary + doc.employee_id.contract_id.house_allowance_temp + doc.employee_id.contract_id.transport_allowance"/>
|
||||
<span t-esc="round(doc.employee_id.contract_id.salary + doc.employee_id.contract_id.house_allowance_temp + doc.employee_id.contract_id.transport_allowance,2)"/>
|
||||
<span>ريال</span>
|
||||
</td>
|
||||
<td>Total Salary / month</td>
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@
|
|||
<tr>
|
||||
<td>الراتب الشهري الإجمالي</td>
|
||||
<td colspan="2">
|
||||
<span t-field="doc.employee_id.contract_id.total_net"/>
|
||||
<span t-esc="round(doc.employee_id.contract_id.total_net,2)"/>
|
||||
<span>ريال</span>
|
||||
</td>
|
||||
<td>Total Salary / month</td>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
<group>
|
||||
<group>
|
||||
<field name="from_hr" string="Another Employee" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="employee_id" string="Employee"
|
||||
<field name="employee_id" string="Employee" groups="hr.group_hr_user,hr_base.group_division_manager"
|
||||
attrs="{'readonly': ['|',('from_hr','=',False),('state','!=','draft')],'required':True}"/>
|
||||
<field name="employee_no" string="Employee Number" readonly="1"/>
|
||||
<field name="contract_id" string="Contract" readonly="True" groups="hr.group_hr_user"/>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
'views/payroll_report.xml',
|
||||
'views/contract_advantage.xml',
|
||||
'views/bank_pdf_report.xml',
|
||||
'views/company_custom.xml',
|
||||
'views/menu_security_cus.xml',
|
||||
|
||||
# menus
|
||||
|
|
@ -50,7 +51,9 @@
|
|||
'wizard/payslip_monthly_report_view.xml',
|
||||
'wizard/payroll_bank_report_view.xml',
|
||||
|
||||
|
||||
# reports templates
|
||||
'templates/payroll_bank_text.xml',
|
||||
'templates/hr_payslip_run_template.xml',
|
||||
'templates/payslip_monthly_report.xml',
|
||||
'templates/report_payslip_details.xml',
|
||||
|
|
|
|||
|
|
@ -1599,6 +1599,12 @@ msgstr "طباعة Excel"
|
|||
msgid "Print PDF"
|
||||
msgstr "طباعة PDF"
|
||||
|
||||
#. module: exp_payroll_custom
|
||||
#: model:ir.actions.report,name:exp_payroll_custom.payroll_bank_wiz_report_docx
|
||||
#: model_terms:ir.ui.view,arch_db:exp_payroll_custom.bank_payroll_report_form
|
||||
msgid "Print Text"
|
||||
msgstr "طباعة Text"
|
||||
|
||||
#. module: exp_payroll_custom
|
||||
#: model_terms:ir.ui.view,arch_db:exp_payroll_custom.employee_promotions_form_view
|
||||
msgid "Promotion Date"
|
||||
|
|
@ -2599,3 +2605,18 @@ msgstr "التدريب"
|
|||
msgid "Sorry, The Pyroll period Must be During the same Month"
|
||||
msgstr "للأسف، فترة الراتب يجب أن تكون خلال نفس الشهر"
|
||||
|
||||
#. module: exp_payroll_custom
|
||||
#: model:ir.model.fields,field_description:exp_payroll_custom.field_res_company__company_hr_no
|
||||
msgid "Number Of Company For HR"
|
||||
msgstr "رقم الشركة للموارد البشرية"
|
||||
|
||||
#. module: exp_payroll_custom
|
||||
#: model:ir.model.fields,field_description:exp_payroll_custom.field_res_company__company_pay_no
|
||||
msgid "Company Pay Number"
|
||||
msgstr "رقم الدفع في الشركة"
|
||||
|
||||
#. module: exp_payroll_custom
|
||||
#: model:ir.model.fields,field_description:exp_payroll_custom.field_payroll_bank_wiz__pay_date
|
||||
msgid "Pay Date"
|
||||
msgstr "تاريخ الدفع"
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,5 @@ from . import salary_advance
|
|||
from . import hr_advance_payslip
|
||||
from . import employee_promotions
|
||||
from . import employee_reward
|
||||
from . import company_costum
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class CompanyCustom(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
company_hr_no = fields.Char(string="Number Of Company For HR")
|
||||
company_pay_no = fields.Char(string="Company Pay Number")
|
||||
|
|
@ -2269,8 +2269,8 @@ class HrPayslipRun(models.Model):
|
|||
year_current_from = datetime.strptime(str(self.date_start), '%Y-%m-%d').strftime('%y')
|
||||
month_current_to = datetime.strptime(str(self.date_end), '%Y-%m-%d').strftime('%m')
|
||||
year_current_to = datetime.strptime(str(self.date_end), '%Y-%m-%d').strftime('%y')
|
||||
#if month_current_from != month_current_to or year_current_from != year_current_to:
|
||||
# raise exceptions.Warning(_('Sorry, The Pyroll period Must be During the same Month'))
|
||||
if month_current_from != month_current_to or year_current_from != year_current_to:
|
||||
raise exceptions.Warning(_('Sorry, The Pyroll period Must be During the same Month'))
|
||||
|
||||
@api.depends('salary_scale.transfer_type')
|
||||
def compute_type(self):
|
||||
|
|
|
|||
|
|
@ -802,6 +802,821 @@ class PayslipBankReport(models.AbstractModel):
|
|||
'date_to': date_to,
|
||||
}
|
||||
|
||||
class PayslipBankReport(models.AbstractModel):
|
||||
_name = 'report.exp_payroll_custom.report_payroll_bank_pdf_docx'
|
||||
|
||||
@api.model
|
||||
def _get_report_values(self, docids, data=None):
|
||||
total_docs_count = 0
|
||||
total_amount_salary = 0
|
||||
number_of_records = 0
|
||||
if not data.get('form'):
|
||||
raise UserError(_("Form content is missing, this report cannot be printed."))
|
||||
emp_ids = data['employees']
|
||||
bank_ids = data['banks']
|
||||
salary_ids = data['salary']
|
||||
date_from = data['date_from']
|
||||
date_to = data['date_to']
|
||||
company_id = data['company_id']
|
||||
employees = self.sudo().env['hr.employee'].browse(emp_ids)
|
||||
salary = self.sudo().env['hr.payroll.structure'].browse(salary_ids)
|
||||
banks = self.sudo().env['res.bank'].browse(bank_ids)
|
||||
no_details = data['no_details']
|
||||
report_type = data['report_type']
|
||||
entry_type = data['entry_type']
|
||||
bank_type = data['bank_type']
|
||||
all_bank = self.sudo().env['res.bank'].search([])
|
||||
Module = self.env['ir.module.module'].sudo()
|
||||
branch = Module.search([('state', '=', 'installed'), ('name', '=', 'bi_odoo_multi_branch_hr')])
|
||||
|
||||
|
||||
data = []
|
||||
if not no_details:
|
||||
for bank in banks:
|
||||
docs = []
|
||||
if report_type == 'salary':
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id', 'in', employees.ids),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)
|
||||
])
|
||||
|
||||
elif salary:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('struct_id', 'in', salary_ids),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
elif salary and employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id', 'in', employees.ids),
|
||||
('struct_id', 'in', salary.ids),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
else:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
[('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id', 'in', employees.ids),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id), '|',
|
||||
('move_id.state', '=', 'posted'), ('payslip_run_id.move_id.state', '=', 'posted')])
|
||||
|
||||
elif salary:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('struct_id', 'in', salary_ids), ('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
'|'
|
||||
, ('move_id.state', '=', 'posted'), ('payslip_run_id.move_id.state', '=', 'posted')
|
||||
])
|
||||
elif salary and employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id', 'in', employees.ids),
|
||||
('struct_id', 'in', salary.ids),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id), '|',
|
||||
('move_id.state', '=', 'posted'), ('payslip_run_id.move_id.state', '=', 'posted')])
|
||||
else:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
'|',
|
||||
('move_id.state', '=', 'posted'), ('payslip_run_id.move_id.state', '=', 'posted')])
|
||||
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id', 'in', employees.ids),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id), '|',
|
||||
('move_id.state', '=', 'draft'), ('payslip_run_id.move_id.state', '=', 'draft'),
|
||||
])
|
||||
|
||||
elif salary:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('struct_id', 'in', salary_ids), '|',
|
||||
('move_id.state', '=', 'draft'), ('payslip_run_id.move_id.state', '=', 'draft'),
|
||||
])
|
||||
elif salary and employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id', 'in', employees.ids),
|
||||
('struct_id', 'in', salary.ids),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id), '|',
|
||||
('move_id.state', '=', 'draft'), ('payslip_run_id.move_id.state', '=', 'draft')])
|
||||
else:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
'|',
|
||||
('move_id.state', '=', 'draft'), ('payslip_run_id.move_id.state', '=', 'draft')])
|
||||
|
||||
for payslip in payslips:
|
||||
tot_basic = 0.0
|
||||
tot_housing = 0.0
|
||||
tot_other = 0.0
|
||||
tot_net = 0.0
|
||||
tot_ded = 0.0
|
||||
|
||||
net = 0.0
|
||||
basic = 0.0
|
||||
housing = 0.0
|
||||
other = 0.0
|
||||
total = 0.0
|
||||
|
||||
salary_rules = self.sudo().env['hr.salary.rule'].search([]).sorted(
|
||||
key=lambda v: v.sequence).ids
|
||||
payslip_line_obj = self.sudo().env['hr.payslip.line']
|
||||
payslip_lines_ids = payslip_line_obj.sudo().search([('slip_id', '=', payslip.id)])
|
||||
if not payslip_lines_ids:
|
||||
continue
|
||||
|
||||
for payslip_line_rec in payslip_lines_ids:
|
||||
if payslip_line_rec.salary_rule_id.id in salary_rules:
|
||||
if payslip_line_rec.salary_rule_id.rules_type == 'salary':
|
||||
basic += payslip_line_rec.total
|
||||
elif payslip_line_rec.salary_rule_id.rules_type == 'house':
|
||||
housing += payslip_line_rec.total
|
||||
other = payslip.total_allowances - basic - housing
|
||||
deduction = total - net
|
||||
tot_net += net
|
||||
tot_basic += basic
|
||||
tot_housing += housing
|
||||
tot_other += other
|
||||
tot_ded += deduction
|
||||
|
||||
docs.append({
|
||||
'ID': payslip.employee_id.emp_no,
|
||||
'Name': payslip.employee_id.english_name,
|
||||
'Account #': payslip.employee_id.bank_account_id.acc_number,
|
||||
'Bank': payslip.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': payslip.total_sum,
|
||||
'National': payslip.employee_id.saudi_number.saudi_id if payslip.employee_id.check_nationality == True else
|
||||
payslip.employee_id.iqama_number.iqama_id,
|
||||
'Basic': basic,
|
||||
'Housing': housing,
|
||||
'Other': round(other, 2),
|
||||
'Deduction': round((payslip.total_deductions + payslip.total_loans), 2),
|
||||
'Address': payslip.employee_id.branch_id.name if branch else payslip.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency': payslip.employee_id.company_id.currency_id.name
|
||||
})
|
||||
elif report_type == 'allowance':
|
||||
allowances = self.sudo().env['hr.employee.reward'].search(
|
||||
['&', ('date', '>=', date_from), ('date', '<=', date_to), ('state', '=', 'done')
|
||||
])
|
||||
for allowance in allowances:
|
||||
reward_line_obj = self.sudo().env['lines.ids.reward']
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids), ('move_id.state', '=', 'posted')])
|
||||
else:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id), ('move_id.state', '=', 'posted'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('move_id.state', '=', 'draft'),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id), ('move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
|
||||
if not reward_lines_ids:
|
||||
continue
|
||||
|
||||
for reward in reward_lines_ids:
|
||||
docs.append({
|
||||
'ID': reward.employee_id.emp_no,
|
||||
'Name': reward.employee_id.english_name,
|
||||
'Account #': reward.employee_id.bank_account_id.acc_number,
|
||||
'Bank': reward.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': reward.amount,
|
||||
'National': reward.employee_id.saudi_number.saudi_id if reward.employee_id.check_nationality == True else
|
||||
reward.employee_id.iqama_number.iqama_id,
|
||||
'Basic': 0.0,
|
||||
'Housing': 0.0,
|
||||
'Other': 0.0,
|
||||
'Deduction': 0.0,
|
||||
'Address': reward.employee_id.branch_id.name if branch else reward.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency': reward.employee_id.company_id.currency_id.name
|
||||
})
|
||||
elif report_type == 'overtime':
|
||||
overtime = self.sudo().env['employee.overtime.request'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('transfer_type', '=', 'accounting'), ('state', '=', 'validated')
|
||||
])
|
||||
for over in overtime:
|
||||
reward_line_obj = self.sudo().env['line.ids.over.time']
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id), ('move_id.state', '=', 'posted'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id), ('move_id.state', '=', 'posted'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id), ('move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id), ('move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
|
||||
if not overtime_lines_ids:
|
||||
continue
|
||||
|
||||
for ove in overtime_lines_ids:
|
||||
docs.append({
|
||||
'ID': ove.employee_id.emp_no,
|
||||
'Name': ove.employee_id.english_name,
|
||||
'Account #': ove.employee_id.bank_account_id.acc_number,
|
||||
'Bank': ove.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': ove.price_hour,
|
||||
'National': ove.employee_id.saudi_number.saudi_id if ove.employee_id.check_nationality == True else
|
||||
ove.employee_id.iqama_number.iqama_id,
|
||||
'Basic': 0.0,
|
||||
'Housing': 0.0,
|
||||
'Other': 0.0,
|
||||
'Deduction': 0.0,
|
||||
'Address': ove.employee_id.branch_id.name if branch else ove.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency': ove.employee_id.company_id.currency_id.name
|
||||
})
|
||||
elif report_type == 'mission':
|
||||
missions = self.sudo().env['hr.official.mission'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('process_type', '=', 'mission'), ('state', '=', 'approve')
|
||||
])
|
||||
for mission in missions:
|
||||
mission_line_obj = self.sudo().env['hr.official.mission.employee']
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids), ('account_move_id.state', '=', 'posted')])
|
||||
else:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id), ('account_move_id.state', '=', 'posted'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id), ('account_move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id), ('account_move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
|
||||
if not mission_lines_ids:
|
||||
continue
|
||||
|
||||
for miss in mission_lines_ids:
|
||||
docs.append({
|
||||
'ID': miss.employee_id.emp_no,
|
||||
'Name': miss.employee_id.english_name,
|
||||
'Account #': miss.employee_id.bank_account_id.acc_number,
|
||||
'Bank': miss.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': miss.amount,
|
||||
'National': miss.employee_id.saudi_number.saudi_id if miss.employee_id.check_nationality == True else
|
||||
miss.employee_id.iqama_number.iqama_id,
|
||||
'Basic': 0.0,
|
||||
'Housing': 0.0,
|
||||
'Other': 0.0,
|
||||
'Deduction': 0.0,
|
||||
'Address': miss.employee_id.branch_id.name if branch else miss.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency': miss.employee_id.company_id.currency_id.name
|
||||
})
|
||||
elif report_type == 'training':
|
||||
trainings = self.sudo().env['hr.official.mission'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('process_type', '=', 'training'), ('state', '=', 'approve')
|
||||
])
|
||||
for training in trainings:
|
||||
training_line_obj = self.sudo().env['hr.official.mission.employee']
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids), ('account_move_id.state', '=', 'posted')])
|
||||
else:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('account_move_id.state', '=', 'posted')])
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id), ('account_move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id), ('account_move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', '=', bank.id)])
|
||||
|
||||
if not training_lines_ids:
|
||||
continue
|
||||
|
||||
for train in training_lines_ids:
|
||||
docs.append({
|
||||
'ID': train.employee_id.emp_no,
|
||||
'Name': train.employee_id.english_name,
|
||||
'Account #': train.employee_id.bank_account_id.acc_number,
|
||||
'Bank': train.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': train.amount,
|
||||
'National': train.employee_id.saudi_number.saudi_id if train.employee_id.check_nationality == True else
|
||||
train.employee_id.iqama_number.iqama_id,
|
||||
'Basic': 0.0,
|
||||
'Housing': 0.0,
|
||||
'Other': 0.0,
|
||||
'Deduction': 0.0,
|
||||
'Address': train.employee_id.branch_id.name if branch else train.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency': train.employee_id.company_id.currency_id.name
|
||||
})
|
||||
|
||||
counter = docs.count
|
||||
data.append({
|
||||
'docs': docs,
|
||||
|
||||
'bank': bank.name,
|
||||
'report_type': report_type,
|
||||
'no_details': no_details,
|
||||
'bank_type': bank_type,
|
||||
'counter': counter
|
||||
})
|
||||
|
||||
else:
|
||||
docs = []
|
||||
if report_type == 'salary':
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('employee_id', 'in', employees.ids),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
|
||||
elif salary:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('struct_id', 'in', salary_ids),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
elif salary and employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('employee_id', 'in', employees.ids), ('struct_id', 'in', salary.ids),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
else:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('employee_id', 'in', employees.ids),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)
|
||||
, '|',
|
||||
('move_id.state', '=', 'posted'), ('payslip_run_id.move_id.state', '=', 'posted')
|
||||
])
|
||||
|
||||
elif salary:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('struct_id', 'in', salary_ids),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids), '|',
|
||||
('move_id.state', '=', 'posted'), ('payslip_run_id.move_id.state', '=', 'posted')])
|
||||
elif salary and employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'), ('employee_id', 'in', employees.ids),
|
||||
('struct_id', 'in', salary.ids),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids), '|',
|
||||
('move_id.state', '=', 'posted'), ('payslip_run_id.move_id.state', '=', 'posted')])
|
||||
else:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)
|
||||
, '|',
|
||||
('move_id.state', '=', 'posted'), ('payslip_run_id.move_id.state', '=', 'posted')
|
||||
])
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('employee_id', 'in', employees.ids),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)
|
||||
, '|',
|
||||
('move_id.state', '=', 'draft'), ('payslip_run_id.move_id.state', '=', 'draft')
|
||||
])
|
||||
|
||||
elif salary:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('struct_id', 'in', salary_ids),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)
|
||||
, '|',
|
||||
('move_id.state', '=', 'draft'), ('payslip_run_id.move_id.state', '=', 'draft')
|
||||
])
|
||||
elif salary and employees:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('employee_id', 'in', employees.ids), ('struct_id', 'in', salary.ids),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)
|
||||
, '|',
|
||||
('move_id.state', '=', 'draft'), ('payslip_run_id.move_id.state', '=', 'draft')
|
||||
])
|
||||
else:
|
||||
payslips = self.sudo().env['hr.payslip'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('state', '=', 'transfered'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)
|
||||
, '|',
|
||||
('move_id.state', '=', 'draft'), ('payslip_run_id.move_id.state', '=', 'draft')
|
||||
])
|
||||
|
||||
for payslip in payslips:
|
||||
tot_basic = 0.0
|
||||
tot_housing = 0.0
|
||||
tot_other = 0.0
|
||||
tot_net = 0.0
|
||||
tot_ded = 0.0
|
||||
net = 0.0
|
||||
basic = 0.0
|
||||
housing = 0.0
|
||||
other = 0.0
|
||||
total = 0.0
|
||||
salary_rules = self.sudo().env['hr.salary.rule'].search([]).sorted(
|
||||
key=lambda v: v.sequence).ids
|
||||
payslip_line_obj = self.sudo().env['hr.payslip.line']
|
||||
payslip_lines_ids = payslip_line_obj.sudo().search([('slip_id', '=', payslip.id)])
|
||||
if not payslip_lines_ids:
|
||||
continue
|
||||
|
||||
for payslip_line_rec in payslip_lines_ids:
|
||||
if payslip_line_rec.salary_rule_id.id in salary_rules:
|
||||
if payslip_line_rec.salary_rule_id.rules_type == 'salary':
|
||||
basic += payslip_line_rec.total
|
||||
elif payslip_line_rec.salary_rule_id.rules_type == 'house':
|
||||
housing += payslip_line_rec.total
|
||||
other = payslip.total_allowances - basic - housing
|
||||
deduction = total - net
|
||||
tot_net += net
|
||||
tot_basic += basic
|
||||
tot_housing += housing
|
||||
tot_other += other
|
||||
tot_ded += deduction
|
||||
docs.append({
|
||||
'ID': payslip.employee_id.emp_no,
|
||||
'Name': payslip.employee_id.english_name,
|
||||
'Account #': payslip.employee_id.bank_account_id.acc_number,
|
||||
'Bank': payslip.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': payslip.total_sum,
|
||||
'National': payslip.employee_id.saudi_number.saudi_id if payslip.employee_id.check_nationality == True else
|
||||
payslip.employee_id.iqama_number.iqama_id,
|
||||
'Basic': basic,
|
||||
'Housing': housing,
|
||||
'Other': round(other, 2),
|
||||
'Deduction': round((payslip.total_deductions + payslip.total_loans), 2),
|
||||
'Address': payslip.employee_id.branch_id.name if branch else payslip.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency': payslip.employee_id.company_id.currency_id.name
|
||||
})
|
||||
elif report_type == 'allowance':
|
||||
allowances = self.sudo().env['hr.employee.reward'].search(
|
||||
['&', ('date', '>=', date_from), ('date', '<=', date_to), ('state', '=', 'done')
|
||||
])
|
||||
for allowance in allowances:
|
||||
reward_line_obj = self.sudo().env['lines.ids.reward']
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids), ('move_id.state', '=', 'posted')])
|
||||
else:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id), ('move_id.state', '=', 'posted'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id), ('move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
reward_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_reward_id', '=', allowance.id), ('move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
|
||||
if not reward_lines_ids:
|
||||
continue
|
||||
|
||||
for reward in reward_lines_ids:
|
||||
docs.append({
|
||||
'ID': reward.employee_id.emp_no,
|
||||
'Name': reward.employee_id.english_name,
|
||||
'Account #': reward.employee_id.bank_account_id.acc_number,
|
||||
'Bank': reward.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': reward.amount,
|
||||
'National': reward.employee_id.saudi_number.saudi_id if reward.employee_id.check_nationality == True else
|
||||
reward.employee_id.iqama_number.iqama_id,
|
||||
'Basic': 0.0,
|
||||
'Housing': 0.0,
|
||||
'Other': 0.0,
|
||||
'Deduction': 0.0,
|
||||
'Address': reward.employee_id.branch_id.name if branch else reward.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency': reward.employee_id.company_id.currency_id.name
|
||||
})
|
||||
elif report_type == 'overtime':
|
||||
overtime = self.sudo().env['employee.overtime.request'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('transfer_type', '=', 'accounting'), ('state', '=', 'validated')
|
||||
])
|
||||
for over in overtime:
|
||||
reward_line_obj = self.sudo().env['line.ids.over.time']
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids), ('move_id.state', '=', 'posted')])
|
||||
else:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id), ('move_id.state', '=', 'posted'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids), ('move_id.state', '=', 'draft')])
|
||||
else:
|
||||
overtime_lines_ids = reward_line_obj.sudo().search(
|
||||
[('employee_over_time_id', '=', over.id), ('move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
|
||||
if not overtime_lines_ids:
|
||||
continue
|
||||
|
||||
for ove in overtime_lines_ids:
|
||||
docs.append({
|
||||
'ID': ove.employee_id.emp_no,
|
||||
'Name': ove.employee_id.english_name,
|
||||
'Account #': ove.employee_id.bank_account_id.acc_number,
|
||||
'Bank': ove.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': ove.price_hour,
|
||||
'National': ove.employee_id.saudi_number.saudi_id if ove.employee_id.check_nationality == True else
|
||||
ove.employee_id.iqama_number.iqama_id,
|
||||
'Basic': 0.0,
|
||||
'Housing': 0.0,
|
||||
'Other': 0.0,
|
||||
'Deduction': 0.0,
|
||||
'Address': ove.employee_id.branch_id.name if branch else ove.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency':ove.employee_id.company_id.currency_id.name
|
||||
})
|
||||
elif report_type == 'mission':
|
||||
missions = self.sudo().env['hr.official.mission'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to), ('process_type', '=', 'mission'),
|
||||
('state', '=', 'approve')
|
||||
])
|
||||
for mission in missions:
|
||||
mission_line_obj = self.sudo().env['hr.official.mission.employee']
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids), ('account_move_id.state', '=', 'posted')])
|
||||
else:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id), ('account_move_id.state', '=', 'posted'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id), ('account_move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
mission_lines_ids = mission_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', mission.id), ('account_move_id.state', '=', 'draft'),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
|
||||
if not mission_lines_ids:
|
||||
continue
|
||||
|
||||
for miss in mission_lines_ids:
|
||||
docs.append({
|
||||
'ID': miss.employee_id.emp_no,
|
||||
'Name': miss.employee_id.english_name,
|
||||
'Account #': miss.employee_id.bank_account_id.acc_number,
|
||||
'Bank': miss.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': miss.amount,
|
||||
'National': miss.employee_id.saudi_number.saudi_id if miss.employee_id.check_nationality == True else
|
||||
miss.employee_id.iqama_number.iqama_id,
|
||||
'Basic': 0.0,
|
||||
'Housing': 0.0,
|
||||
'Other': 0.0,
|
||||
'Deduction': 0.0,
|
||||
'Address': miss.employee_id.branch_id.name if branch else miss.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency': miss.employee_id.company_id.currency_id.name
|
||||
})
|
||||
elif report_type == 'training':
|
||||
trainings = self.sudo().env['hr.official.mission'].search(
|
||||
['&', ('date_from', '>=', date_from), ('date_to', '<=', date_to),
|
||||
('process_type', '=', 'training'), ('state', '=', 'approve')
|
||||
])
|
||||
for training in trainings:
|
||||
training_line_obj = self.sudo().env['hr.official.mission.employee']
|
||||
if entry_type == 'all':
|
||||
if employees:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids)])
|
||||
else:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids)])
|
||||
elif entry_type == 'posted':
|
||||
if employees:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids), ('account_move_id.state', '=', 'posted')])
|
||||
else:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('account_move_id.state', '=', 'posted')])
|
||||
elif entry_type == 'unposted':
|
||||
if employees:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('employee_id', 'in', employees.ids), ('account_move_id.state', '=', 'draft')])
|
||||
else:
|
||||
training_lines_ids = training_line_obj.sudo().search(
|
||||
[('official_mission_id', '=', training.id),
|
||||
('employee_id.bank_account_id.bank_id', 'in', all_bank.ids),
|
||||
('account_move_id.state', '=', 'draft')])
|
||||
|
||||
if not training_lines_ids:
|
||||
continue
|
||||
|
||||
for train in training_lines_ids:
|
||||
docs.append({
|
||||
'ID': train.employee_id.emp_no,
|
||||
'Name': train.employee_id.english_name,
|
||||
'Account #': train.employee_id.bank_account_id.acc_number,
|
||||
'Bank': train.employee_id.bank_account_id.bank_id.bic,
|
||||
'Salary': train.amount,
|
||||
'National': train.employee_id.saudi_number.saudi_id if train.employee_id.check_nationality == True else
|
||||
train.employee_id.iqama_number.iqama_id,
|
||||
'Basic': 0.0,
|
||||
'Housing': 0.0,
|
||||
'Other': 0.0,
|
||||
'Deduction': 0.0,
|
||||
'Address': train.employee_id.branch_id.name if branch else train.employee_id.working_location.name,
|
||||
'Pay Description': report_type,
|
||||
'currency': train.employee_id.company_id.currency_id.name
|
||||
})
|
||||
|
||||
# counter = docs.count('ID')+1
|
||||
# print("###########################",counter)
|
||||
data.append({
|
||||
'docs': docs,
|
||||
'bank': '',
|
||||
'report_type': report_type,
|
||||
'no_details': no_details,
|
||||
# 'counter': counter
|
||||
})
|
||||
total_docs_count = sum(len(entry['docs']) for entry in data)
|
||||
total_amount_salary = sum(doc['Salary'] for entry in data for doc in entry['docs'])
|
||||
number_of_records = total_docs_count+2
|
||||
return {
|
||||
'banks': banks,
|
||||
'data': data,
|
||||
'date_from': date_from,
|
||||
'date_to': date_to,
|
||||
'company_id': company_id,
|
||||
'counter':total_docs_count,
|
||||
'number_of_records':number_of_records,
|
||||
'total_amount_salary':total_amount_salary
|
||||
}
|
||||
|
||||
|
||||
class PayrollXlsx(models.AbstractModel):
|
||||
_name = 'report.exp_payroll_custom.report_payroll_bank_xlsx'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<template id="report_payroll_bank_pdf_docx">
|
||||
<t t-foreach="data" t-as="v"><t>IFH,IFILE,CSV,,SASABBGSA011400330,CONv21420210824144123,</t><t t-esc="datestamp" widget="datetime"></t>,<t><t t-esc="timestamp" widget="datetime"></t></t><t>,P,1.1,</t><t><t t-esc="number_of_records"/> </t>
|
||||
<t>BATHDR,ACH-CR,<t><t t-esc="company_hr_no"/></t>,<t><t t-esc="counter"/></t>,,,,<t><t t-esc="salary_type"/></t>,Salary,,@1ST@,<t t-set="date_value" t-value="pay_date"/><t t-esc="date_value.replace('-', '').replace('/', '')"/>,00<t t-esc="company_pay_no"></t>,<t t-esc="currency"></t>,<t t-esc="round(total_amount_salary)"></t>,,,,,,,,<t t-esc="company_id"></t>,<t t-esc="phone"></t>,,,,CONV210824144123</t><t t-if="bank_type=='rajhi'"><t t-foreach="v['docs']" t-as="o"><t></t>
|
||||
<t>SECPTY,</t><t><t t-esc="o['Account #']"/></t>,<t><t t-esc="o['Name']"/></t>,<t><t t-esc="o['ID']"/></t>,<t><t t-esc="o['Bank']"/></t>,,,<t><t t-esc="'%.2f'% o['Salary']"/></t>,,,,,,,N,N,,,,,,@SACH@,<t><t t-esc="o['National']"/></t>,<t><t t-esc="o['Basic']"/></t>,<t><t t-esc="o['Housing']"/></t> <t>,<t t-esc="o['Other']"/></t>,<t><t t-esc="o['Deduction']"/></t>,<t>salary of <t t-esc="pay_slip"/></t> </t></t>
|
||||
<t t-elif="bank_type=='alahli'"><t t-foreach="v['docs']" t-as="o"><t></t>
|
||||
<t>SECPTY,</t><t><t t-esc="o['Account #']"/></t>,<t><t t-esc="o['Name']"/></t>,<t><t t-esc="o['ID']"/></t>,<t><t t-esc="o['Bank']"/></t>,,,<t><t t-esc="'%.2f'% o['Salary']"/></t>,,,,,,,N,N,,,,,,@SACH@,<t><t t-esc="o['National']"/></t>,<t><t t-esc="o['Basic']"/></t>,<t><t t-esc="o['Housing']"/></t> <t>,<t t-esc="o['Other']"/></t>,<t><t t-esc="o['Deduction']"/></t>,<t>salary of <t t-esc="pay_slip"/></t></t></t>
|
||||
<t t-elif="bank_type=='riyadh'"><t t-foreach="v['docs']" t-as="o"><t></t>
|
||||
<t>SECPTY,</t><t><t t-esc="o+['Account #']"/></t>,<t><t t-esc="o['Name']"/></t>,<t><t t-esc="o['ID']"/></t>,<t><t t-esc="o['Bank']"/></t>,,,<t><t t-esc="'%.2f'% o['Salary']"/></t>,,,,,,,N,N,,,,,,@SACH@,<t><t t-esc="o['National']"/></t>,<t><t t-esc="o['Basic']"/></t>,<t><t t-esc="o['Housing']"/></t> <t>,<t t-esc="o['Other']"/></t>,<t><t t-esc="o['Deduction']"/></t>,<t>salary of <t t-esc="pay_slip"/></t> </t></t></t>
|
||||
</template>
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
@ -1,6 +1,309 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<template id="report_payroll_bank_pdf_docx">
|
||||
<t t-call="web.html_container">
|
||||
<t t-call="hr_base.hr_layout" translation="off">
|
||||
<style>
|
||||
@font-face {font-family: "Sakkal Majalla"; src:
|
||||
url("/employee_requests/static/fonts/ce7b5754581057e6f7444e2192850cc8.eot"); src:
|
||||
url("/employee_requests/static/fonts/ce7b5754581057e6f7444e2192850cc8.eot?#iefix")
|
||||
format("embedded-opentype"),
|
||||
url("/employee_requests/static/fonts/ce7b5754581057e6f7444e2192850cc8.woff2") format("woff2"),
|
||||
url("/employee_requests/static/fonts/ce7b5754581057e6f7444e2192850cc8.woff") format("woff"),
|
||||
url("/employee_requests/static/fonts/ce7b5754581057e6f7444e2192850cc8.ttf") format("truetype");
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="page" style="font-family: 'Sakkal Majalla'!important;font-size:14pt;direction:rtl">
|
||||
<t t-set="sequence" t-value="0"/>
|
||||
<t t-foreach="data" t-as="v">
|
||||
<h3 style="text-align: center;color: font-weight: bold;">
|
||||
<strong t-if="v['report_type']=='salary'">مسير البنك للرواتب</strong>
|
||||
<strong t-if="v['report_type']=='allowance'">مسير البنك للحوافز</strong>
|
||||
<strong t-if="v['report_type']=='overtime'">مسير البنك للعمل الإضافي</strong>
|
||||
<strong t-if="v['report_type']=='training'">مسير البنك للتدريب</strong>
|
||||
<strong t-if="v['report_type']=='mission'">مسير البنك لمهام العمل</strong>
|
||||
<br/>
|
||||
<span t-esc="date_from"/>
|
||||
---
|
||||
<span t-esc="date_to"/>
|
||||
</h3>
|
||||
<p t-if="v['no_details']==False"
|
||||
style="text-align:right;font-weight:bold;padding:0px; line-height: 1.1;">
|
||||
<span>بنك :</span>
|
||||
<span t-esc="v['bank']"/>
|
||||
</p>
|
||||
<t t-if="bank_type=='rajhi'">
|
||||
<table class="table table-condensed table-bordered">
|
||||
<thead style="margin-top:0px;background: #3e5d7f;text-align: center;color: #ffffff;valign: middle;"
|
||||
class="text-center">
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
رقم الموظف
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
إسم الموظف
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
رقم الحساب
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
البنك
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
المبلغ
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
الهوية
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
الراتب الأساسي
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
بدل السكن
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
بدلات أخرى
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
الخصم
|
||||
</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr t-foreach="v['docs']" t-as="o">
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['ID']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Name']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Account #']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Bank']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="'%.2f'% o['Salary']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['National']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Basic']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Housing']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Other']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Deduction']"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p style="page-break-after:always"></p>
|
||||
</t>
|
||||
<t t-elif="bank_type=='alahli'">
|
||||
<table class="table table-condensed table-bordered">
|
||||
<thead style="margin-top:0px;background: #3e5d7f;text-align: center;color: #ffffff;valign: middle;"
|
||||
class="text-center">
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Bank
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Account Number
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Total Salary
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Transaction Reference
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Employee Name
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
National ID/Iqama ID
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Employee Address
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Basic Salary
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Housing Allowance
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Other Earnings
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
Deductions
|
||||
</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr t-foreach="v['docs']" t-as="o">
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Bank']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Account #']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="'%.2f'% o['Salary']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['ID']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Name']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['National']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Address']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Basic']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Housing']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Other']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Deduction']"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p style="page-break-after:always"></p>
|
||||
</t>
|
||||
<t t-elif="bank_type=='riyadh'">
|
||||
<table class="table table-condensed table-bordered">
|
||||
<thead style="margin-top:0px;background: #3e5d7f;text-align: center;color: #ffffff;valign: middle;"
|
||||
class="text-center">
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
SN
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
هوية المستفيد/ المرجع
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
المستفيد / اسم الموظف
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
رقم الحساب
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
رمز البنك
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
إجمالي المبلغ
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
الراتب الأساسي
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
بدل السكن
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
دخل آخر
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
الخصومات
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
العنوان
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
العملة
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
الحالة
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
وصف الدفع
|
||||
</th>
|
||||
<th style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;text-align:center;">
|
||||
مرجع الدفع
|
||||
</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr t-foreach="v['docs']" t-as="o">
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<t t-set="sequence" t-value="sequence +1"/>
|
||||
<t t-esc="sequence"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['National']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Name']"/>
|
||||
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['ID']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Bank']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="'%.2f'% o['Salary']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Basic']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Basic']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Housing']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Housing']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Other']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Deduction']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Address']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['currency']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['Pay Description']"/>
|
||||
</td>
|
||||
<td style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap">
|
||||
<span t-esc="o['ID']"/>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p style="page-break-after:always"></p>
|
||||
</t>
|
||||
|
||||
|
||||
</t>
|
||||
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
<template id="report_payroll_bank_pdf">
|
||||
<t t-call="web.html_container">
|
||||
<t t-call="hr_base.hr_layout" translation="off">
|
||||
|
|
@ -304,5 +607,6 @@
|
|||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="res_company_form_inherit" model="ir.ui.view">
|
||||
<field name="name">res.company.form.inherit</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='phone']" position="after">
|
||||
<field name="company_hr_no"/>
|
||||
<field name="company_pay_no"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
@ -51,6 +51,14 @@
|
|||
<field name="report_name">exp_payroll_custom.report_payroll_bank_pdf</field>
|
||||
<field name="attachment_use">False</field>
|
||||
</record>
|
||||
<record id="payroll_bank_wiz_report_docx" model="ir.actions.report">
|
||||
<field name="model">payroll.bank.wiz</field>
|
||||
<field name="name">Print Text</field>
|
||||
<field name="report_type">qweb-text</field>
|
||||
<field name="report_name">exp_payroll_custom.report_payroll_bank_pdf_docx</field>
|
||||
<field name="binding_type">report</field>
|
||||
<field name="attachment_use">False</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
# -*- coding:utf-8 -*-
|
||||
|
||||
from datetime import date
|
||||
from datetime import date, datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.tools import pytz
|
||||
import datetime
|
||||
|
||||
class BankPayslipReport(models.TransientModel):
|
||||
_name = 'payroll.bank.wiz'
|
||||
|
|
@ -12,6 +14,12 @@ class BankPayslipReport(models.TransientModel):
|
|||
default=lambda self: date(date.today().year, date.today().month, 1))
|
||||
date_to = fields.Date(string='Date To', required=True,
|
||||
default=lambda self: date(date.today().year, date.today().month, 1)+relativedelta(months=1,days=-1))
|
||||
pay_date = fields.Date(
|
||||
string='Pay Date',
|
||||
required=False)
|
||||
salary_type= fields.Char(
|
||||
string='',
|
||||
required=False)
|
||||
|
||||
bank_ids = fields.Many2many('res.bank', string='Banks',required=True)
|
||||
salary_ids = fields.Many2many('hr.payroll.structure', 'hrpayroll_rel', 'salary_id', 'colum2_id',string='Salary Structures')
|
||||
|
|
@ -37,7 +45,6 @@ class BankPayslipReport(models.TransientModel):
|
|||
[('rajhi', 'Al-Rajhi Bank'),
|
||||
('alahli', 'Al-Ahli Bank'),
|
||||
('riyadh', 'Al-Riyadh Bank'),
|
||||
('sap', 'SAP Bank'),
|
||||
], default='rajhi', string='Select Bank')
|
||||
|
||||
@api.onchange('date_from')
|
||||
|
|
@ -45,6 +52,8 @@ class BankPayslipReport(models.TransientModel):
|
|||
if self.date_from :
|
||||
self.date_to = fields.Date.from_string(self.date_from)+relativedelta(months=+1, day=1, days=-1)
|
||||
|
||||
|
||||
|
||||
def print_pdf_report(self):
|
||||
self.ensure_one()
|
||||
[data] = self.read()
|
||||
|
|
@ -59,6 +68,10 @@ class BankPayslipReport(models.TransientModel):
|
|||
bank_type = self.bank_type
|
||||
company_id = self.env['res.company'].search([('id', '=', self.company_id.id)])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
datas = {
|
||||
'employees': employees.ids,
|
||||
'banks': banks.ids,
|
||||
|
|
@ -75,6 +88,8 @@ class BankPayslipReport(models.TransientModel):
|
|||
|
||||
return self.env.ref('exp_payroll_custom.bank_payslip_report').report_action(self, data=datas)
|
||||
|
||||
|
||||
|
||||
def print_report(self):
|
||||
[data] = self.read()
|
||||
date_from = self.date_from
|
||||
|
|
@ -104,3 +119,65 @@ class BankPayslipReport(models.TransientModel):
|
|||
}
|
||||
|
||||
return self.env.ref('exp_payroll_custom.report_payroll_bank_xlsx').report_action(self,data=datas)
|
||||
|
||||
def print_report_text(self):
|
||||
self.ensure_one()
|
||||
[data] = self.read()
|
||||
date_from = self.date_from.strftime("%B")
|
||||
date_from = self.date_from
|
||||
date_to = self.date_to
|
||||
pay_slip = self.date_from.strftime("%B %Y")
|
||||
employees = self.env['hr.employee'].search([('id', 'in', self.employee_ids.ids)])
|
||||
banks = self.env['res.bank'].search([('id', 'in', self.bank_ids.ids)])
|
||||
salary = self.env['hr.payroll.structure'].search([('id', 'in', self.salary_ids.ids)])
|
||||
no_details = self.no_details
|
||||
report_type = self.report_type
|
||||
entry_type = self.entry_type
|
||||
bank_type = self.bank_type
|
||||
company_id = self.env['res.company'].search([('id', '=', self.company_id.id)])
|
||||
company_hr_no = self.env['res.company'].search([('id', '=', self.company_id.id)]).company_hr_no
|
||||
phone = self.env['res.company'].search([('id', '=', self.company_id.id)]).phone
|
||||
company_pay_no = self.env['res.company'].search([('id', '=', self.company_id.id)]).company_pay_no
|
||||
datestamp = datetime.datetime.now().strftime("%Y/%m/%d")
|
||||
timestamp = datetime.datetime.now().strftime("%H:%M:%S")
|
||||
print(timestamp)
|
||||
currency = self.env['res.company'].search([('id', '=', self.company_id.id)]).currency_id.name
|
||||
pay_date = self.pay_date
|
||||
if report_type == 'salary':
|
||||
self.salary_type = 'S'
|
||||
elif report_type=='overtime':
|
||||
self.salary_type = 'O'
|
||||
else:
|
||||
self.salary_type='B'
|
||||
salary_type = self.salary_type
|
||||
|
||||
|
||||
|
||||
|
||||
datas = {
|
||||
'employees': employees.ids,
|
||||
'banks': banks.ids,
|
||||
'salary': salary.ids,
|
||||
'form': data,
|
||||
'date_from':date_from,
|
||||
'date_to': date_to,
|
||||
'no_details': no_details,
|
||||
'report_type': report_type,
|
||||
'entry_type': entry_type,
|
||||
'bank_type': bank_type,
|
||||
'company_id': company_id.english_name,
|
||||
'timestamp': timestamp,
|
||||
'datestamp': datestamp,
|
||||
'currency': currency,
|
||||
'pay_date': pay_date,
|
||||
'salary_type': salary_type,
|
||||
'company_hr_no': company_hr_no,
|
||||
'phone': phone,
|
||||
'company_pay_no': company_pay_no,
|
||||
'pay_slip': pay_slip,
|
||||
|
||||
}
|
||||
return self.env.ref('exp_payroll_custom.payroll_bank_wiz_report_docx').report_action(self, data=datas)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<field name="date_from" />
|
||||
<field name="no_details"/>
|
||||
<field name="bank_type"/>
|
||||
<field name="pay_date"/>
|
||||
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
|
||||
</group>
|
||||
<group>
|
||||
|
|
@ -45,8 +46,9 @@
|
|||
</sheet>
|
||||
<footer>
|
||||
<button name="print_pdf_report" string="Print PDF" type="object" class="oe_highlight"/>
|
||||
<button name="print_report" string="Print Excel" type="object" default_focus="1"/>
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
<button name="print_report" string="Print Excel" type="object" default_focus="1" class="oe_highlight"/>
|
||||
<button name="print_report_text" string="Print Text" type="object" default_focus="1" class="oe_highlight"/>
|
||||
<button string="Cancel" class="oe_highlight" special="cancel"/>
|
||||
</footer>
|
||||
|
||||
|
||||
|
|
@ -71,4 +73,4 @@
|
|||
parent="exp_payroll_custom.menu_hr_payroll_report"/>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
</odoo>
|
||||
|
|
|
|||
Loading…
Reference in New Issue