Permalink
Browse files

[FIX] hr_payroll_account: Allow salary rules to be used in multicompa…

…nies

Before this commit
- Install a **l10n_xx_hr_payroll** which includes information of the rules (it always install in the main company: **Company A** in this use case).
- Configure the accounting for the rules
- Create **Company B**
- Use the same salary rules for both companies, as **l10n_xx_hr_payroll** modules are not multicompany.

Behavior:
- **Company A** accounts are shown in **Company B** salary rules.
- If the accounts are changed in **Company B** rules, it also overrides **Company A** accounts, (which causes major confusions, and great mistakes if a payslip is run).
- A salary rule with **Company A** set on `company_id` can still be **seen** through Company B. which causes that it can be mistakenly _ran by a user in Company B_, with the _accounting of Company A_.

After this commit:
Salary rules accounting can be used with multi-company
  • Loading branch information...
gustavovalverde authored and tivisse committed Sep 10, 2018
1 parent 13e68d6 commit 3e8553e1d9156ac30ccc76a1ef43cdbf9cc50ed1
Showing with 4 additions and 4 deletions.
  1. +4 −4 addons/hr_payroll_account/models/hr_payroll_account.py
@@ -145,10 +145,10 @@ def action_payslip_done(self):
class HrSalaryRule(models.Model):
_inherit = 'hr.salary.rule'
analytic_account_id = fields.Many2one('account.analytic.account', 'Analytic Account')
account_tax_id = fields.Many2one('account.tax', 'Tax')
account_debit = fields.Many2one('account.account', 'Debit Account', domain=[('deprecated', '=', False)])
account_credit = fields.Many2one('account.account', 'Credit Account', domain=[('deprecated', '=', False)])
analytic_account_id = fields.Many2one('account.analytic.account', 'Analytic Account', company_dependent=True)
account_tax_id = fields.Many2one('account.tax', 'Tax', company_dependent=True)
account_debit = fields.Many2one('account.account', 'Debit Account', company_dependent=True, domain=[('deprecated', '=', False)])
account_credit = fields.Many2one('account.account', 'Credit Account', company_dependent=True, domain=[('deprecated', '=', False)])
class HrContract(models.Model):
_inherit = 'hr.contract'

0 comments on commit 3e8553e

Please sign in to comment.