In Odoo 13 we have encountered a multi company problem, where there need's to be the same set of salary rules and salary structures (belonging to the OCA payroll module) for each company.
We don't want to statically define the records for each company:
what we want is to create is an Odoo function that automatically creates the records for each company and links to the proper accounts in the accounting plan for the proper company:
@api.model
def create_rule_for_every_company(self):
"""
function that'll create the rule for each company, in the group_system
"""
(function is called on installing the module from the XML data file)
But then quickly realized that you need to do the same for the salary structure and such, and so I'm wondering if there's an easier way to do this in the Odoo logic that I don't know of.
The purpose of doing this is to have every rule linked to the proper : account.account
for the company.
Basically, I came up with this:
Still looking for more optimal solutions.
This solution feels unstable.