Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
44ab349
multicompany_property_account
etobella Jan 30, 2018
3fa5750
multicompany_property_account: Configure accounting on company view.
etobella Jan 31, 2018
b0304c2
- Property fields are readonly only in views. - Update readme and style
JordiBForgeFlow Apr 10, 2018
f21d70c
Add company fields for accounts
etobella Apr 11, 2018
0bb639b
Remove unrelation of company on account move
etobella Apr 26, 2018
df55e03
create property if it does not exist
etobella May 10, 2018
9c5058b
fix set_property_value in res_company
JordiBForgeFlow May 17, 2018
ee95acc
remove ir.property record when needed
JordiBForgeFlow May 17, 2018
5878272
fix views
JordiBForgeFlow Nov 12, 2018
19894be
JordiBForgeFlow Dec 18, 2018
85442a9
multicompany_property_account
Jun 6, 2019
d31ce8c
group changes
Mar 10, 2020
1f02abd
Migrate multicompany_property modules to 13.0
JordiBForgeFlow Apr 14, 2021
d74dc45
multicompany_property_*: full update to v13
MiquelRForgeFlow Apr 14, 2021
d64b543
improve views
JordiBForgeFlow Apr 28, 2021
0760f2d
allow payment terms not associated to a single company
JordiBForgeFlow May 10, 2021
9f4fcc8
multicompany_property_account: make account payable/receivable not re…
JordiMForgeFlow Jun 29, 2021
0ed8f5e
*: Migration to 13.0
MiquelRForgeFlow May 18, 2020
ead9e93
mcfix_*: Finish migration [IMP] github actions: Improve management [I…
etobella Jun 29, 2021
ceaeab5
multicompany_property_view: Show tax_lock_date
etobella Oct 20, 2021
99f5635
multicompany_property_account: black, isort, prettier
LoisRForgeFlow Oct 22, 2021
29ac4ac
multicompany_property_account
LoisRForgeFlow Oct 22, 2021
a22dc91
multicompany_property_account: property get method is now private in v14
LoisRForgeFlow Nov 4, 2021
79d6500
multicompany_property_account: remove current_company_id from domain
JordiMForgeFlow Nov 15, 2021
bfcbb76
[IMP] multicompany_property_account: black, isort, prettier
Aug 3, 2022
b2fd6e5
[MIG] multicompany_property_account: Migration to 15.0
Aug 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions multicompany_property_account/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3

=============================
Multicompany Property Account
=============================

This module is part of a set of modules that allow to set property fields on
a given model for multiple companies simultaneously. Specifically this module:

* Allows to define the company-specific accounting fields of the product and
product category in the new 'Multi company' page of the product form view.

* Allows to define the company-specific accounting fields of the partner
in the new 'Multi company' page of the partner form view.


Company
-------

* Adds a page 'Accounting' in the company that allows to maintain
company-specific accounting settings that one would usually maintain
separately for each company in 'Invoicing / Settings'.


Credits
=======

Contributors
------------

* Enric Tobella <etobella@creublanca.es>
* Jordi Ballester <jordi.ballester@forgeflow.com>
* Miquel Raïch <miquel.raich@forgeflow.com>
* Lois Rilo <lois.rilo@forgeflow.com>

Do not contact contributors directly about support or help with technical issues.

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
1 change: 1 addition & 0 deletions multicompany_property_account/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
25 changes: 25 additions & 0 deletions multicompany_property_account/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2017 Creu Blanca
# Copyright 2017-21 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "Multi Company Property Account",
"version": "15.0.1.0.0",
"summary": "Account Company Properties",
"author": "Creu Blanca, ForgeFlow, Odoo Community Association (OCA)",
"sequence": 30,
"license": "LGPL-3",
"website": "https://github.com/ForgeFlow/multicompany-fixes",
"depends": ["account", "multicompany_property_product"],
"data": [
"security/ir.model.access.csv",
"views/partner_views.xml",
"views/product_views.xml",
"views/product_category_views.xml",
"views/res_company_views.xml",
"views/tax_group_views.xml",
],
"installable": True,
"application": False,
"auto_install": True,
}
5 changes: 5 additions & 0 deletions multicompany_property_account/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import res_company
from . import res_partner
from . import product
from . import product_category
from . import account_tax_group
95 changes: 95 additions & 0 deletions multicompany_property_account/models/account_tax_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright 2021 Creu Blanca
# Copyright 2021 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


class AccountTaxGroup(models.Model):
_inherit = "account.tax.group"

property_ids = fields.One2many(
comodel_name="account.tax.group.property",
compute="_compute_properties",
inverse="_inverse_properties",
string="Properties",
)

def _inverse_properties(self):
"""Hack here: We do not really store any value here.
But this allows us to have the fields of the transient
model editable."""
return

def _compute_properties(self):
for record in self:
property_obj = self.env["account.tax.group.property"]
values = []
for company in self.env.companies:
val = property_obj.create(
{"tax_group_id": record.id, "company_id": company.id}
)
values.append(val.id)
record.property_ids = values


class AccountTaxGroupProperty(models.TransientModel):
_name = "account.tax.group.property"
_inherit = "model.property"
_description = "Properties of Tax groups"

tax_group_id = fields.Many2one(comodel_name="account.tax.group")
property_tax_payable_account_id = fields.Many2one(
"account.account",
compute="_compute_property_fields",
readonly=False,
string="Tax current account (payable)",
)
property_tax_receivable_account_id = fields.Many2one(
"account.account",
compute="_compute_property_fields",
readonly=False,
string="Tax current account (receivable)",
)
property_advance_tax_payment_account_id = fields.Many2one(
"account.account",
compute="_compute_property_fields",
readonly=False,
string="Advance Tax payment account",
)

def _compute_property_fields(self):
self.ensure_one()
obj = self.tax_group_id
self.get_property_fields(
obj,
self.env["ir.property"].with_company(self.company_id),
)

def get_property_fields(self, obj, properties):
for rec in self:
rec.property_tax_payable_account_id = rec.get_property_value(
"property_tax_payable_account_id", obj, properties
)
rec.property_tax_receivable_account_id = rec.get_property_value(
"property_tax_receivable_account_id", obj, properties
)
rec.property_advance_tax_payment_account_id = rec.get_property_value(
"property_advance_tax_payment_account_id", obj, properties
)

def get_property_fields_list(self):
res = super(AccountTaxGroupProperty, self).get_property_fields_list()
res.append("property_tax_payable_account_id")
res.append("property_tax_receivable_account_id")
res.append("property_advance_tax_payment_account_id")
return res

def write(self, vals):
prop_obj = self.env["ir.property"].with_company(self.company_id)
p_fields = self.get_property_fields_list()
for field in p_fields:
if field in vals:
for rec in self:
self.set_property(rec.tax_group_id, field, vals[field], prop_obj)
return super(AccountTaxGroupProperty, self).write(vals)
49 changes: 49 additions & 0 deletions multicompany_property_account/models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2017 Creu Blanca
# Copyright 2017 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


class ProductProperty(models.TransientModel):
_inherit = "product.property"

property_account_income_id = fields.Many2one(
comodel_name="account.account",
string="Income Account",
domain=[("deprecated", "=", False)],
compute="_compute_property_fields",
readonly=False,
store=False,
help="Keep this field empty to use the default value from the "
"product category.",
)
property_account_expense_id = fields.Many2one(
comodel_name="account.account",
string="Expense Account",
domain=[("deprecated", "=", False)],
compute="_compute_property_fields",
readonly=False,
store=False,
help="Keep this field empty to use the default value from the "
"product category. If anglo-saxon accounting with automated "
"valuation method is configured, the expense account on the "
"product category will be used.",
)

def get_property_fields(self, obj, properties):
res = super(ProductProperty, self).get_property_fields(obj, properties)
for rec in self:
rec.property_account_income_id = rec.get_property_value(
"property_account_income_id", obj, properties
)
rec.property_account_expense_id = rec.get_property_value(
"property_account_expense_id", obj, properties
)
return res

def get_property_fields_list(self):
res = super(ProductProperty, self).get_property_fields_list()
res.append("property_account_income_id")
res.append("property_account_expense_id")
return res
48 changes: 48 additions & 0 deletions multicompany_property_account/models/product_category.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2017 Creu Blanca
# Copyright 2017 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


class ProductCategoryProperty(models.TransientModel):
_inherit = "product.category.property"

property_account_income_categ_id = fields.Many2one(
comodel_name="account.account",
string="Income Account",
domain=[("deprecated", "=", False)],
compute="_compute_property_fields",
readonly=False,
store=False,
help="This account will be used when validating a customer invoice.",
)
property_account_expense_categ_id = fields.Many2one(
comodel_name="account.account",
string="Expense Account",
domain=[("deprecated", "=", False)],
compute="_compute_property_fields",
readonly=False,
store=False,
help="The expense is accounted for when a vendor bill is validated, "
"except in anglo-saxon accounting with perpetual inventory "
"valuation in which case the expense (Cost of Goods Sold account) "
"is recognized at the customer invoice validation.",
)

def get_property_fields(self, obj, properties):
res = super(ProductCategoryProperty, self).get_property_fields(obj, properties)
for rec in self:
rec.property_account_income_categ_id = rec.get_property_value(
"property_account_income_categ_id", obj, properties
)
rec.property_account_expense_categ_id = rec.get_property_value(
"property_account_expense_categ_id", obj, properties
)
return res

def get_property_fields_list(self):
res = super(ProductCategoryProperty, self).get_property_fields_list()
res.append("property_account_income_categ_id")
res.append("property_account_expense_categ_id")
return res
Loading