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.

"""a class that will be used into the , mainly for usability purposes"""
            def sum(self, code, from_date, to_date=None):
                if to_date is None:
                    to_date = fields.Date.today()
                self.env.cr.execute("""SELECT sum(case when hp.credit_note = False then (pl.total) else (-pl.total) end)
                            FROM hr_payslip as hp, hr_payslip_line as pl
                            WHERE hp.employee_id = %s AND hp.state = 'done'
                            AND hp.date_from >= %s AND hp.date_to <= %s AND hp.id = pl.slip_id AND pl.code = %s""",
                            (self.employee_id, from_date, to_date, code))
                res = self.env.cr.fetchone()
                return res and res[0] or 0.0
        
        result_dict = {}
        rules_dict = {}
        worked_days_dict = {}
        inputs_dict = {}
        blacklist = []
        payslip = self.env['hr.payslip'].browse(payslip_id)
        for worked_days_line in payslip.worked_days_line_ids:
            worked_days_dict[worked_days_line.code] = worked_days_line
        for input_line in payslip.input_line_ids:
            inputs_dict[input_line.code] = input_line
        categories = BrowsableObject(payslip.employee_id.id, {}, self.env)