work on payroll

This commit is contained in:
sonal arora
2020-09-21 08:09:54 +00:00
parent d665dee271
commit 21bb7be1ca
3 changed files with 44 additions and 24 deletions

View File

@@ -162,14 +162,20 @@ class HrPayslip(models.Model):
contract_ids = payslip.contract_id.ids or \ contract_ids = payslip.contract_id.ids or \
self.get_contract(payslip.employee_id, payslip.date_from, payslip.date_to) self.get_contract(payslip.employee_id, payslip.date_from, payslip.date_to)
for contract in self.contract_id: for contract in self.contract_id:
print('contract++++++++++++++++=',contract) print('contract++++++++++++++++=',contract.wage,contract.hra,contract.other_allowance,contract.travel_allowance)
total_salary = contract.wage + contract.other_allowance + contract.hra + contract.travel_allowance
list_value =[(0, 0, { list_value =[(0, 0, {
'emloyee_payslip_id':self.id, 'date_from':payslip.date_from,
'date_to':payslip.date_to,
'state':payslip.state,
'number':payslip.number,
'emloyee_payslip_id':payslip.id,
'employee_id':payslip.employee_id.id, 'employee_id':payslip.employee_id.id,
'basic_salary':contract.wage, 'basic_salary':contract.wage,
'other_allowances':contract.other_allowance, 'other_allowance':contract.other_allowance,
'housing_allowance':contract.hra, 'housing_allowance':contract.hra,
'travel_allowance':contract.travel_allowance 'travel_allowance':contract.travel_allowance,
'total_salary':total_salary
})] })]
print('list_value============',list_value) print('list_value============',list_value)
payslip.emp_salary_line_ids = list_value payslip.emp_salary_line_ids = list_value
@@ -674,14 +680,23 @@ class EmployeeSalary(models.Model):
#basic_salary = fields.Float() #basic_salary = fields.Float()
basic_salary = fields.Integer('Basic Salary',help="Employee's monthly gross wage.") basic_salary = fields.Integer('Basic Salary',help="Employee's monthly gross wage.")
other_allowance = fields.Float() other_allowance = fields.Float()
#housing_allowance = fields.Float('Housing Allowance')
#travel_allowance = fields.Float('Transportation Allowance')
other_allowances = fields.Monetary(string="Other Allowance", help="Other allowances") other_allowances = fields.Monetary(string="Other Allowance", help="Other allowances")
housing_allowance = fields.Monetary(string='HRA', tracking=True, help="House rent allowance.") housing_allowance = fields.Monetary(string='HRA', tracking=True, help="House rent allowance.")
travel_allowance = fields.Monetary(string="Travel Allowance", help="Travel allowance") travel_allowance = fields.Monetary(string="Travel Allowance", help="Travel allowance")
total_salary = fields.Float('Total Salary') total_salary = fields.Float('Gross Salary')
monthly_deduct = fields.Float('Monthly Deduction in AED') loan_deduct = fields.Float('Loan Deduduction')
monthly_deduct = fields.Float('Other Deduction')
deduction_start_date = fields.Date('Deduction Start Date') deduction_start_date = fields.Date('Deduction Start Date')
deduction_end_date = fields.Date('Deduction End Date') deduction_end_date = fields.Date('Deduction End Date')
currency_id = fields.Many2one(string="Currency", related='company_id.currency_id', readonly=True) currency_id = fields.Many2one(string="Currency", related='company_id.currency_id', readonly=True)
company_id = fields.Many2one('res.company', default=lambda self: self.env.company,) company_id = fields.Many2one('res.company', default=lambda self: self.env.company,)
date_from = fields.Date(string='Date From')
date_to = fields.Date(string='Date To')
number = fields.Char(string='Reference')
net_salary = fields.Float('Net Salary')
state = fields.Selection([
('draft', 'Draft'),
('verify', 'Waiting'),
('done', 'Done'),
('cancel', 'Rejected'),
], string='Status', index=True, readonly=True, copy=False, default='draft',)

View File

@@ -5,17 +5,21 @@
<field name="name">employee.salary.rule.tree</field> <field name="name">employee.salary.rule.tree</field>
<field name="model">employee.salary.rule</field> <field name="model">employee.salary.rule</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Employee Salary Rule" editable="bottom" decoration-info="total == 0"> <tree string="Employee Salary Rule" editable="bottom">
<field name="number"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="employee_id"/> <field name="employee_id"/>
<field name="basic_salary"/> <field name="basic_salary"/>
<field name="other_allowance"/> <field name="other_allowance"/>
<field name="housing_allowance"/> <field name="housing_allowance"/>
<field name="travel_allowance"/> <field name="travel_allowance"/>
<field name="total_salary"/> <field name="total_salary"/>
<field name="monthly_deduct"/> <field name="loan_deduct"/>
<field name="deduction_start_date"/> <field name="monthly_deduct"/>
<field name="deduction_end_date"/> <field name="net_salary"/>
<field name="emloyee_payslip_id"/> <field name="emloyee_payslip_id" invisible="1"/>
<field name="state" invisible="1"/>
</tree> </tree>
</field> </field>
</record> </record>
@@ -34,10 +38,9 @@
<field name="travel_allowance"/> <field name="travel_allowance"/>
<field name="total_salary"/> <field name="total_salary"/>
</group> </group>
<group> <group>
<field name="loan_deduct"/>
<field name="monthly_deduct"/> <field name="monthly_deduct"/>
<field name="deduction_start_date"/>
<field name="deduction_end_date"/>
<field name="emloyee_payslip_id"/> <field name="emloyee_payslip_id"/>
</group> </group>
</group> </group>
@@ -47,15 +50,17 @@
<record id="action_view_employee_salary_rule_form" model="ir.actions.act_window"> <record id="action_view_employee_salary_rule_form" model="ir.actions.act_window">
<field name="name">Employee SalaryRule</field> <field name="name">Employee Payslip Details</field>
<field name="res_model">employee.salary.rule</field> <field name="res_model">employee.salary.rule</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<!-- <field name="search_view_id" ref="view_hr_payslip_filter"/> --> <!--<field name="domain">[('state', '=', 'done')]</field>
<field name="search_view_id" ref="view_hr_payslip_filter"/> -->
</record> </record>
<menuitem action="action_view_employee_salary_rule_form" <menuitem action="action_view_employee_salary_rule_form"
id="menu_salary_rule_view" id="menu_salary_rule_view"
parent="menu_hr_payroll_community_root" name="Employee Payslip Details"
parent="menu_hr_payroll_community_root"
/> />
<!-- Payslip Line --> <!-- Payslip Line -->
<record id="view_hr_payslip_line_tree" model="ir.ui.view"> <record id="view_hr_payslip_line_tree" model="ir.ui.view">
@@ -309,7 +314,7 @@
<field name="note" placeholder="Add an internal note..."/> <field name="note" placeholder="Add an internal note..."/>
</div> </div>
</page> </page>
<page string="Employee Salary rule"> <!--<page string="Employee Salary rule">
<separator string="Employee Rule"/> <separator string="Employee Rule"/>
<field name="emp_salary_line_ids"> <field name="emp_salary_line_ids">
<tree string="Employee Salary Rule" editable="bottom"> <tree string="Employee Salary Rule" editable="bottom">
@@ -326,7 +331,7 @@
<field name="company_id"/> <field name="company_id"/>
</tree> </tree>
</field> </field>
</page> </page>-->
</notebook> </notebook>
</sheet> </sheet>
</form> </form>