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.

blacklist += [id for id, seq in rule._recursive_search_of_rules()]
        return [value for code, value in result_dict.items()]
    
    
    @api.multi
    def onchange_employee_id(self, date_from, date_to, employee_id=False, contract_id=False):
        
        res = {
            'value': {
                'line_ids': [],
                
                'input_line_ids': map(lambda x: (2, x,), self.input_line_ids.ids),
                
                'worked_days_line_ids': map(lambda x: (2, x,), self.worked_days_line_ids.ids),
                
                'name': '',
                'contract_id': False,
                'struct_id': False,
            }
        }
        if (not employee_id) or (not date_from) or (not date_to):
            return res
        ttyme = datetime.fromtimestamp(time.mktime(time.strptime(date_from, "%Y-%m-%d")))
        employee = self.env['hr.employee'].browse(employee_id)
        res['value'].update({
                    'name': _('Salary Slip of %s for %s') % (employee.name, tools.ustr(ttyme.strftime('%B-%Y'))),
                    'company_id': employee.company_id.id
        })
        if not self.env.context.get('contract'):