Files
odoo_source/addons/account/models/account_analytic_distribution_model.py
T
william-andre 0479b2b594 [IMP] account,*: manage subsidiary companies
Allow sharing records between company
* accounts
* taxes
* fiscal positions
* products
* ...and some related models

These records can be read and used in children companies.

This can be used to
* have different branding for different businesses
* allow more complex security rules
* consolidate branches differently
* manage different tax reports with different tax ids in the same
  country

task-3371677

closes odoo/odoo#125642

Related: odoo/enterprise#43215
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2023-07-20 11:49:06 +02:00

30 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
from odoo import fields, models
class AccountAnalyticDistributionModel(models.Model):
_inherit = 'account.analytic.distribution.model'
account_prefix = fields.Char(
string='Accounts Prefix',
help="This analytic distribution will apply to all financial accounts sharing the prefix specified.",
)
product_id = fields.Many2one(
'product.product',
string='Product',
ondelete='cascade',
check_company=True,
help="Select a product for which the analytic distribution will be used (e.g. create new customer invoice or Sales order if we select this product, it will automatically take this as an analytic account)",
)
product_categ_id = fields.Many2one(
'product.category',
string='Product Category',
ondelete='cascade',
help="Select a product category which will use analytic account specified in analytic default (e.g. create new customer invoice or Sales order if we select this product, it will automatically take this as an analytic account)",
)
def _create_domain(self, fname, value):
if not fname == 'account_prefix':
return super()._create_domain(fname, value)