fix
This commit is contained in:
parent
4cf88628c4
commit
28ad59cb4d
|
|
@ -963,7 +963,7 @@ class PayslipBankReport(models.AbstractModel):
|
|||
'Basic': basic,
|
||||
'Housing': housing,
|
||||
'Other': round(other, 2),
|
||||
'Deduction': round((payslip.total_deductions + payslip.total_loans), 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
|
||||
|
|
@ -1355,7 +1355,7 @@ class PayslipBankReport(models.AbstractModel):
|
|||
'Basic': basic,
|
||||
'Housing': housing,
|
||||
'Other': round(other, 2),
|
||||
'Deduction': round((payslip.total_deductions + payslip.total_loans), 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
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ class PayslipMonthlyReport(models.AbstractModel):
|
|||
for line in self.env['hr.salary.rule'].browse(data['rule_ids']):
|
||||
rule_dict.setdefault(line.category_id.rule_type, [])
|
||||
rule_dict[line.category_id.rule_type] += line
|
||||
tdict = {'count': '#', 'emp_no': _('EMP #'), 'emp': _('Name'), }
|
||||
ndict = {'count': '','emp_no':_('Nets') ,'emp':''}
|
||||
tdict = {'count': '#', 'emp_no':_('EMP #'),'emp': _('Name'), }
|
||||
ndict = {'count': '', 'emp_no': _('Nets'),'emp':'' }
|
||||
for key, value in rule_dict.items():
|
||||
for x in value:
|
||||
tdict[x.id], ndict[x.id] = x.name, 0
|
||||
|
|
@ -100,15 +100,15 @@ class PayslipMonthlyReport(models.AbstractModel):
|
|||
count = 0
|
||||
ftotal = 0
|
||||
inner_doc = {'rule': rule.name, 'lines': [], }
|
||||
inner_doc['lines'].append({'count': '#', 'emp_no': _('EMP #'), 'emp': _('Employee'), 'amount': _('Amount')})
|
||||
inner_doc['lines'].append({'count': '#', 'emp_no': _('EMP #'), 'emp': _('Employee'), 'amount': _('Amount'), })
|
||||
for emp in set(payslip_line.browse(data['payslip_line_ids']).filtered(
|
||||
lambda r: r.salary_rule_id.id == rule.id).mapped('employee_id')):
|
||||
count += 1
|
||||
total = sum(payslip_line.browse(data['payslip_line_ids']).filtered(
|
||||
lambda r: r.employee_id.id == emp.id and r.salary_rule_id.id == rule.id).mapped('amount'))
|
||||
ftotal += total
|
||||
inner_doc['lines'].append({'count': count, 'emp_no': emp.emp_no, 'emp': emp.name, 'amount': total})
|
||||
inner_doc['lines'].append({'count': '', 'emp_no': _('Total'),'emp':'', 'amount': ftotal})
|
||||
inner_doc['lines'].append({'count': count, 'emp_no': emp.emp_no, 'emp': emp.name, 'amount': total, })
|
||||
inner_doc['lines'].append({'count': '', 'emp_no': _('Total'),'emp':'', 'amount': ftotal, })
|
||||
docs.append(inner_doc)
|
||||
return title, exception, docs
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,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 t-foreach="data" t-as="v"><t>IFH,IFILE,CSV,,SASABBGSA011400330,<t><t t-esc="random_char"/></t><t t-set="date_value" t-value="pay_date"/><t t-esc="date_value.replace('-', '').replace('/', '').replace(':', '')"/>00,</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="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 t-esc="company_hr_no"/></t>,<t><t t-esc="company_registry"/></t>,,,,<t><t t-esc="random_char2"/></t><t t-set="date_value" t-value="timestamp" widget="datetime"/><t t-esc="date_value.replace('-', '').replace('/', '').replace(':', '')"/>00</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>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from dateutil.relativedelta import relativedelta
|
|||
from odoo import models, fields, api, _
|
||||
from odoo.tools import pytz
|
||||
import datetime
|
||||
import random
|
||||
|
||||
class BankPayslipReport(models.TransientModel):
|
||||
_name = 'payroll.bank.wiz'
|
||||
|
|
@ -138,11 +139,14 @@ class BankPayslipReport(models.TransientModel):
|
|||
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
|
||||
company_registry = self.env['res.company'].search([('id', '=', self.company_id.id)]).company_registry
|
||||
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 self.pay_date:
|
||||
pay_date = self.pay_date
|
||||
else:
|
||||
pay_date = self.date_to
|
||||
if report_type == 'salary':
|
||||
self.salary_type = 'S'
|
||||
elif report_type=='overtime':
|
||||
|
|
@ -150,9 +154,14 @@ class BankPayslipReport(models.TransientModel):
|
|||
else:
|
||||
self.salary_type='B'
|
||||
salary_type = self.salary_type
|
||||
|
||||
|
||||
|
||||
## Ranom vlaues in report
|
||||
length_of_string = 5
|
||||
length_of_string2 = 4
|
||||
sample = "ABCDEFGHIJKLMNOPQURSTYWXZ0123456789"
|
||||
generated_string1 = ''.join(random.choice(sample) for _ in range(length_of_string))
|
||||
generated_string2 = ''.join(random.choice(sample) for _ in range(length_of_string2))
|
||||
random_char = str(generated_string1)
|
||||
random_char2 = str(generated_string2)
|
||||
|
||||
datas = {
|
||||
'employees': employees.ids,
|
||||
|
|
@ -174,7 +183,10 @@ class BankPayslipReport(models.TransientModel):
|
|||
'company_hr_no': company_hr_no,
|
||||
'phone': phone,
|
||||
'company_pay_no': company_pay_no,
|
||||
'company_registry': company_registry,
|
||||
'pay_slip': pay_slip,
|
||||
'random_char': random_char,
|
||||
'random_char2': random_char2,
|
||||
|
||||
}
|
||||
return self.env.ref('exp_payroll_custom.payroll_bank_wiz_report_docx').report_action(self, data=datas)
|
||||
|
|
|
|||
Loading…
Reference in New Issue