-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Master salary package configurator yti #15066
Master salary package configurator yti #15066
Conversation
254a5f3
to
428fc05
Compare
f9cd699
to
a0f082d
Compare
c460902
to
7e781d5
Compare
15395f1
to
2171019
Compare
@@ -16,6 +16,7 @@ class Employee(models.Model): | |||
medic_exam = fields.Date(string='Medical Examination Date') | |||
place_of_birth = fields.Char('Place of Birth') | |||
children = fields.Integer(string='Number of Children') | |||
# TODO make a many2one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a bridge.
Add field vehicle_id to set the employee's vehicle. Override vehicle: related="vehicle_id.name"
company_id = fields.Many2one('res.company', default=lambda self: self.env.user.company_id) | ||
resource_calendar_id = fields.Many2one(required=True) | ||
|
||
@api.onchange('company_id', 'company_id.country_id') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vfield value should be visible on the range advantage
@api.onchange('company_id', 'company_id.country_id') | ||
def _onchange_company_id(self): | ||
# import pdb; pdb.set_trace() | ||
# TODO: Should be a default_get on the advantage lines + an onchange on the company to remove/add the new advantages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crap
# TODO: Should be a default_get on the advantage lines + an onchange on the company to remove/add the new advantages | ||
if self.company_id.country_id: | ||
advantages_to_create = self.env['hr.contract.advantage.template'].search([('country_id', '=', self.company_id.country_id.id)]) | ||
command = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint
@@ -98,6 +121,57 @@ def get_all_structures(self): | |||
# YTI TODO return browse records | |||
return list(set(structures._get_parent_structure().ids)) | |||
|
|||
@api.multi | |||
def get_value(self, code): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_get_advantage_value
def get_value(self, code): | ||
self.ensure_one() | ||
advantage_line = self.advantage_ids.filtered(lambda x: x.code == code) | ||
if advantage_line: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return advantage_line.value
return 0.0 | ||
|
||
@api.multi | ||
def get_attribute(self, code, attribute): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_get_advantage_attribute
return getattr(self.env['hr.contract.advantage.template'].search([('code', '=', code)], limit=1), attribute) | ||
|
||
@api.multi | ||
def set_value(self, code, value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_set_advantage_value
|
||
class HrContractAdvantage(models.Model): | ||
_name = 'hr.contract.advantage' | ||
_inherit = 'hr.contract.advantage.template' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove _inherit and add a Many2one to the advatange template. Modify the 3 methods above.
# elif self.transport_mode == 'others': | ||
# pass # What to do here ? | ||
|
||
@api.depends('wage', 'advantage_ids', 'company_car_total_depreciated_cost') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
advantage_ids.type, code, value
) | ||
|
||
@api.onchange('advantage_ids') | ||
def _onchange_meal_voucher_paid_by_employer(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Become compute
@api.depends('wage', 'has_commission_on_target') | ||
def _compute_social_security_contributions(self): | ||
total_wage = self.wage * 13.0 | ||
total_commissions = self.get_value('commission_on_target') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 * Commissions
self.set_value('commission_on_target', values[0].value) | ||
|
||
@api.onchange('new_car_brand_id') | ||
def _onchange_brand_id(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to check if useless
def _get_available_cars_domain(self): | ||
return ['|', ('driver_id', '=', False), ('driver_id', '=', self.employee_id.address_home_id.id)] | ||
|
||
def _get_existing_model_domain(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems useless
2171019
to
5c83eba
Compare
f6752a4
to
351b51d
Compare
973690b
to
c53cc59
Compare
PURPOSE ======= During the Salary Package Configurator implementation, some improvement have been made to improve the fleet management module - When duplicating a fleet vehicle cost (for example when duplication a vehicle contract), duplicate the included costs too. - Add a field Cost Description on the list view - Rename 'Acquisition Date' into 'Immatriculation Date' - Rename 'Car Value' into 'Catalog Value (VAT incl.)' - Add a information field 'Residual Value on a vehicle' - Prevent an employee to have several cars - Only display opened contract on the vehicle form view - Add the driver on the odometer list view - Rename 'Odometer value' into 'Odometer at creation' on a vehicle contract - Restructure to vehicle model form view to be bearable by a human eye - Show the handle widget on the fleet vehicle state list view - Show configuration menuitems to fleet managers, not only debug mode
It's a PITA to have a huge files with all the models into it. We took this opportunity to stick to the guideline.
- Default gender is male - Default marital status is single - Move some fields from the contract to the employee (permit number, visa number, visa expiration date)
- An employee isn't required anymore on a contract, to allow default contract for a certain job - Remove trial_date_start, as we assume that it's the same than the contract date start - wage should be a fields.Monetary - Add a state 'cancel' for a contract - Move some fields to the employee (permit number, visa number, visa expiration date) - Add company and currency on the contract - Restructure contract form view in a so beautiful way
…rovements - Some label improvements - Make the 'Working Schedule' required on a contract to work well on payslip. If not set, the working hours are not taken into account when computing the payslip, leading to a wage salary equal to 0. - Add a hr.contract.advantage.template model. This is kind of a meta model to retrieve specific values for given advantages (like lower and upper bounds or default values). Add related views and actions too. - Only add opened contract by default on a payslip in the onchange_employee_id - Rewrite some method in new api style (with browse records)
…fixes - Add a field HR Responsible, who's the job responsible, not the recruitment responsible - Fix the read_group in `_compute_application_count` method - Only track subtypes for active employees
…ance rules up to 2017
…employees - Update the outdated ones: - Disabled Spouse Allowance - Child Allowance - Retain on Meal Voucher - Reimbursement of travel expenses - Add missing rules: - Reduction for special family charges - Withholding Tax Reduction - Special social contribution - ATN Company Car - ATN Internet - ATN Mobile - Employment Bonus - Withholding Tax Reduction for Low Salaries - Withholding Tax Reduction for Low Salaries (ONSS) - Other family charges reductions - Reduction for isolated people - Reduction for isolated parent - Reduction for disabled employee - Reduction for dependent seniors - Reduction for dependent juniors - Reduction for low spouse revenue - Reduction for low spouse other revenue - Commission on Target - Representation Fees - Add advantage templates with default values
PURPOSE ======= A very small amount of all the existing belgian advantages for employees and workers. The goal of this commit is to implement/update all the advantages and refactor the contract form view to be sexy and usable. SPECIFICATION ============= Contract ~~~~~~~~ - Add advantages: - Transport mode: - Company car - Public transport - Others - Thirteen Month, Double Holidays - Commissions on target + Integration with warrants - Fuel card - Internet - Mobile - Meal Vouchers - Holidays and holidays compensations - Eco checks - Compute employers costs. It's influenced obviously by: - The employee wage - The social security service fees (UCM, ...) - The various advantages - The social security contributions - Implement all the mechanisms to compute those different values and advantages - Refactor the contract form view to be sexy Employee ~~~~~~~~ - Add missing fields to be able to compute correcly the Net Salary from the Gross Salary: - Disabled spouse, spouse fiscal situation and revenues - Dependent people (childen, juniors, seniors, disabled)
…es in belgian payroll - Compute the taxable ATN due to the company car (Depends on the acquisition date, car value, fuel type and CO2 emissions) - Compute the Total Depreciated Cost on the employer costs due to the depreciated recurring amount declared with the car purchase - Allow to retrieve these 2 different values on a vehicle.model in the case we want to have a default value for a new car - Modify name_get on a vehicle.model and the name compute method on a fleet.vehicle to display some useful information like the employer cost (by month) and the acquisition date - A new car may be purchase for an employee when the amount on unused car in the fleet exceeds X. Add a res_config view to configure that behavior - Add the company car mechanism (choose a car, select a new car from available models) on a hr.contract.
This method is used in enterprise currently, but should be in the basic module as it make sense to use it without that
c53cc59
to
3916e0c
Compare
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr