mirror of
https://gitlab.com/sonalarora/tra_backend.git
synced 2025-12-17 10:19:09 +02:00
52 lines
1.9 KiB
Python
Executable File
52 lines
1.9 KiB
Python
Executable File
# -*- coding: utf-8 -*-
|
|
from odoo import models, fields, api
|
|
|
|
|
|
class Employee(models.Model):
|
|
_inherit = 'hr.employee'
|
|
|
|
labour_card_number = fields.Char(string="Employee Card Number", size=14,
|
|
help="Labour Card Number Of Employee")
|
|
salary_card_number = fields.Char(string="Salary Card Number/Account Number", size=16, required=True,
|
|
help="Salary card number or account number of employee")
|
|
agent_id = fields.Many2one('res.bank', string="Agent/Bank", required=True, help="Agent ID or bank ID of Employee")
|
|
|
|
|
|
|
|
class Bank(models.Model):
|
|
_inherit = 'res.bank'
|
|
|
|
routing_code = fields.Char(string="Routing Code", size=9, required=True, help="Bank Route Code")
|
|
|
|
def write(self, vals):
|
|
if 'routing_code' in vals.keys():
|
|
vals['routing_code'] = vals['routing_code'].zfill(9)
|
|
return super(Bank, self).write(vals)
|
|
|
|
@api.model
|
|
def create(self, vals):
|
|
vals['routing_code'] = vals['routing_code'].zfill(9)
|
|
return super(Bank, self).create(vals)
|
|
|
|
|
|
class Company(models.Model):
|
|
_inherit = 'res.company'
|
|
|
|
employer_id = fields.Char(string="Employer ID", help="Company Employer ID")
|
|
|
|
def write(self, vals):
|
|
if 'company_registry' in vals:
|
|
vals['company_registry'] = vals['company_registry'].zfill(13) if vals['company_registry'] else False
|
|
if 'employer_id' in vals:
|
|
vals['employer_id'] = vals['employer_id'].zfill(13) if vals['employer_id'] else False
|
|
return super(Company, self).write(vals)
|
|
|
|
@api.model
|
|
def create(self, vals):
|
|
vals['company_registry'] = vals['company_registry'].zfill(13) if vals['company_registry'] else False
|
|
if 'employer_id' in vals:
|
|
vals['employer_id'] = vals['employer_id'].zfill(13) if vals['employer_id'] else False
|
|
return super(Company, self).create(vals)
|
|
|
|
|