Allowed analytic accounts for a customer or supplier in invoices

Hi all,

We need to restrict allowed analytic accouts for an invoice line. Allowed accounts depend on invoice’s party. The first option seems to be to implement an o2m between party and account and a domain …

another approach?

Thanks in advance

Hi Nicolas,

Why you need such restriction? Normally the analytic accounts are not linked to a party.

With all the information we can provide better advices

I think it could make sense to limit the usage of analytic account on document based on party (but it is only one possibility). But such constraint could never be enforced at the account move level.
For such use case, I would add a Many2Many on analytic account to list the authorized parties. Then on invoice, sale and purchase lines (in short all AnalyticMixin) I would extend the domain with a clause like ('parties', 'in', Eval('analytic_party')) (and of course add a Function field on the lines to compute party).

I’m not sure if it is an enough common practice to become a standard module.