Impacted versions:
10.0 + e

Steps to reproduce:
1) Create a salary rule that has 'appears_on_payslip' = False.
- An example would be a company contribution that the employee does not need to see.
  2) Add it to a salary structure
  3) run a payroll/payslip calculation

Current behavior:
Numerous thing.
1) Every time you compute sheet, you will duplicate these 'hidden' lines
2) details_by_salary_rule_category no longer has any of the hidden lines, though they certainly contribute to categories (e.g. tests will fail, and bad things)
3) when using hr_payroll_account, lines with contribution registers and accounts that SHOULD be on the journal entry are not !!

Expected behavior:
1) every time you compute the sheet, the lines should be deleted and recalculated
2) details_by_salary_rule_category should have all categories (to be able to make complex rules and tests)
3) journal entry should have a line for every line with an account

Pull Request eminent.

addons/hr_payroll/models/hr_payroll.py
default='''
                    # Available variables:
                    #----------------------
                    # payslip: object containing the payslips
                    # employee: hr.employee object
                    # contract: hr.contract object
                    # rules: object containing the rules code (previously computed)
                    # categories: object containing the computed salary rule categories (sum of amount of all rules belonging to that category).
                    # worked_days: object containing the computed worked days.
                    # inputs: object containing the computed inputs.
                    # Note: returned value have to be set in the variable 'result'
                    result = contract.wage * 0.10''')
    amount_percentage_base = fields.Char(string='Percentage based on', help='result will be affected to a variable')
    child_ids = fields.One2many('hr.salary.rule', 'parent_rule_id', string='Child Salary Rule', copy=True)
    register_id = fields.Many2one('hr.contribution.register', string='Contribution Register',
        help="Eventual third party involved in the salary payment of the employees.")
    input_ids = fields.One2many('hr.rule.input', 'input_id', string='Inputs', copy=True)
    note = fields.Text(string='Description')
    @api.multi
    def _recursive_search_of_rules(self):
        """
        @return: returns a list of tuple (id, sequence) which are all the children of the passed rule_ids
        """
        children_rules = []
        for rule in self.filtered(lambda rule: rule.child_ids):
            children_rules += rule.child_ids._recursive_search_of_rules()
        return [(rule.id, rule.sequence) for rule in self] + children_rules
    #T
    @api.multi
    def compute_rule(self, localdict):