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.

amount = fields.Float(help="It is used in computation. For e.g. A rule for sales having "
                               "1% commission of basic salary for per product can defined in expression "
                               "like result = inputs.SALEURO.amount * contract.wage*0.01.")
    contract_id = fields.Many2one('hr.contract', string='Contract', required=True,
        help="The contract for which applied this input")
class HrSalaryRule(models.Model):
    _name = 'hr.salary.rule'
    name = fields.Char(required=True)
    code = fields.Char(required=True,
        help="The code of salary rules can be used as reference in computation of other rules. "
             "In that case, it is case sensitive.")
    sequence = fields.Integer(required=True, index=True, default=5,
        help='Use to arrange calculation sequence')
    quantity = fields.Char(default='1.0',
        help="It is used in computation for percentage and fixed amount. "
             "For e.g. A rule for Meal Voucher having fixed amount of "
             u"1€ per worked day can have its quantity defined in expression "
             "like worked_days.WORK100.number_of_days.")
    category_id = fields.Many2one('hr.salary.rule.category', string='Category', required=True)
    active = fields.Boolean(default=True,
        help="If the active field is set to false, it will allow you to hide the salary rule without removing it.")
    appears_on_payslip = fields.Boolean(string='Appears on Payslip', default=True,
        help="Used to display the salary rule on payslip.")
    parent_rule_id = fields.Many2one('hr.salary.rule', string='Parent Salary Rule', index=True)
    company_id = fields.Many2one('res.company', string='Company',
        default=lambda self: self.env['res.company']._company_default_get())
    condition_select = fields.Selection([
        ('none', 'Always True'),
        ('range', 'Range'),
        ('python', 'Python Expression')