Skip to content

Commit

Permalink
[ADD] fiscal_company_account_fiscal_year
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Nov 14, 2024
1 parent a12a3b6 commit ef24170
Show file tree
Hide file tree
Showing 12 changed files with 313 additions and 0 deletions.
93 changes: 93 additions & 0 deletions fiscal_company_account_fiscal_year/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
=============
CAE - Account
=============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:865035bd18402df3bba578637f93145abbb671b4cf40203c45d4e06706f83b77
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-grap%2Fodoo--addons--cae-lightgray.png?logo=github
:target: https://github.com/grap/odoo-addons-cae/tree/16.0/fiscal_company_account
:alt: grap/odoo-addons-cae

|badge1| |badge2| |badge3|

This module extend Odoo functionnalities, regarding companies features to
manage CAE (Coopearatives of Activities and Employment) that is a special
status for french companies.

**Features**

* Add constrains on ``account.bank.statement``, ``account.invoice``
``account.move``, ``account.move.line``, ``account.payment`` models
that prevent to create such items on a fiscal mother company.

* Account property propagation:
* Following fields property are propagated in all the fiscal child company:
* product_category / property_account_income_categ_id;
* product_category / property_account_expense_categ_id;

**Table of contents**

.. contents::
:local:

Development
===========

For the migration, take care of the tax.filtered occurences in Odoo and OCA modules.
There are a lot of ``filtered(lambda x: x.company_id == current_company)``
in Odoo. The module ``fiscal_company_account`` alter the behaviour of the function
``filtered`` of the ``account.tax`` module, to filter on the mother fiscal company.
However, the changes is imperfect, and multiple filters (company and not company filters)
will fail.

During migration, please run:
``rgrep "tax.*filtered.*company_id"``

Known issues / Roadmap
======================

* the odoo accounting dashboard is disabled, because all the data are bad
computed. (by SQL request), so security access is not possible.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/grap/odoo-addons-cae/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/grap/odoo-addons-cae/issues/new?body=module:%20fiscal_company_account%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* GRAP

Contributors
~~~~~~~~~~~~

* Julien WESTE
* Sylvain LE GAL <https://twitter.com/legalsylvain>

Maintainers
~~~~~~~~~~~

This module is part of the `grap/odoo-addons-cae <https://github.com/grap/odoo-addons-cae/tree/16.0/fiscal_company_account>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions fiscal_company_account_fiscal_year/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import post_init_hook, uninstall_hook
29 changes: 29 additions & 0 deletions fiscal_company_account_fiscal_year/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (C) 2024-Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "CAE - Account Fiscal Year",
"version": "16.0.2.0.0",
"category": "CAE",
"summary": "Glue Module between CAE and Account Fiscal year module",
"author": "GRAP",
"website": "https://github.com/grap/odoo-addons-cae",
"license": "AGPL-3",
"depends": [
# OCA
"account_fiscal_year",
# GRAP
"fiscal_company_account",
],
"data": [
"security/ir_rule.xml",
],
"demo": [
"demo/account_fiscal_year.xml",
],
"post_init_hook": "post_init_hook",
"uninstall_hook": "uninstall_hook",
"installable": True,
"auto_install": True,
}
16 changes: 16 additions & 0 deletions fiscal_company_account_fiscal_year/demo/account_fiscal_year.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2024-Today GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record model="account.fiscal.year" id="fiscal_year">
<field name="name">Exercice 2024</field>
<field name="company_id" ref="fiscal_company_base.company_fiscal_mother"/>
<field name="date_from" eval="'2024-01-01'"/>
<field name="date_to" eval="'2024-12-31'"/>
</record>

</odoo>
25 changes: 25 additions & 0 deletions fiscal_company_account_fiscal_year/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import logging

from odoo import SUPERUSER_ID, api

_logger = logging.getLogger(__name__)


_CORE_RULES = [
"account_fiscal_year.account_fiscal_year_rule", # account.fiscal.year
]


def post_init_hook(cr, registry):
_toggle_standard_rules(cr, False)


def uninstall_hook(cr, registry):
_toggle_standard_rules(cr, True)


def _toggle_standard_rules(cr, enabled):
env = api.Environment(cr, SUPERUSER_ID, {})
for xml_id in _CORE_RULES:
rule = env.ref(xml_id)
rule.active = enabled
100 changes: 100 additions & 0 deletions fiscal_company_account_fiscal_year/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * fiscal_company_account
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-08 12:31+0000\n"
"PO-Revision-Date: 2024-08-08 12:31+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: fiscal_company_account
#: model:ir.model,name:fiscal_company_account.model_account_account
#: model:ir.model.fields,field_description:fiscal_company_account.field_account_move_line__account_id
msgid "Account"
msgstr "Compte"

#. module: fiscal_company_account
#: model:ir.model,name:fiscal_company_account.model_account_bank_statement
msgid "Bank Statement"
msgstr "Relevé bancaire"

#. module: fiscal_company_account
#: model:ir.model,name:fiscal_company_account.model_res_company
msgid "Companies"
msgstr "Sociétés"

#. module: fiscal_company_account
#: model:ir.model.fields,field_description:fiscal_company_account.field_account_account__company_id
#: model:ir.model.fields,field_description:fiscal_company_account.field_account_bank_statement__company_id
msgid "Company"
msgstr "Société"

#. module: fiscal_company_account
#: model:ir.model,name:fiscal_company_account.model_res_partner
msgid "Contact"
msgstr ""

#. module: fiscal_company_account
#: model:ir.model.fields,field_description:fiscal_company_account.field_account_payment__destination_account_id
msgid "Destination Account"
msgstr "Compte de destination"

#. module: fiscal_company_account
#: model:ir.model.fields,field_description:fiscal_company_account.field_res_partner__property_account_position_id
#: model:ir.model.fields,field_description:fiscal_company_account.field_res_users__property_account_position_id
msgid "Fiscal Position"
msgstr "Position fiscale"

#. module: fiscal_company_account
#: model:ir.model,name:fiscal_company_account.model_account_journal
#: model:ir.model.fields,field_description:fiscal_company_account.field_account_bank_statement_line__journal_id
#: model:ir.model.fields,field_description:fiscal_company_account.field_account_move__journal_id
#: model:ir.model.fields,field_description:fiscal_company_account.field_account_payment__journal_id
msgid "Journal"
msgstr ""

#. module: fiscal_company_account
#: model:ir.model,name:fiscal_company_account.model_account_move
msgid "Journal Entry"
msgstr "Pièce comptable"

#. module: fiscal_company_account
#: model:ir.model,name:fiscal_company_account.model_account_move_line
msgid "Journal Item"
msgstr "Écriture comptable"

#. module: fiscal_company_account
#: model:ir.model.fields,field_description:fiscal_company_account.field_account_payment__outstanding_account_id
msgid "Outstanding Account"
msgstr "Compte en suspens"

#. module: fiscal_company_account
#: model:ir.model,name:fiscal_company_account.model_account_payment
msgid "Payments"
msgstr "Paiements"

#. module: fiscal_company_account
#: model:ir.model,name:fiscal_company_account.model_account_tax
msgid "Tax"
msgstr "Taxe"

#. module: fiscal_company_account
#: model:ir.model.fields,field_description:fiscal_company_account.field_account_move_line__tax_ids
msgid "Taxes"
msgstr ""

#. module: fiscal_company_account
#: model:ir.model.fields,help:fiscal_company_account.field_res_partner__property_account_position_id
#: model:ir.model.fields,help:fiscal_company_account.field_res_users__property_account_position_id
msgid ""
"The fiscal position determines the taxes/accounts used for this contact."
msgstr ""
"La position fiscale détermine les taxes/comptes utilisés pour ce contact."
1 change: 1 addition & 0 deletions fiscal_company_account_fiscal_year/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_fiscal_year
17 changes: 17 additions & 0 deletions fiscal_company_account_fiscal_year/models/account_fiscal_year.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (C) 2024-Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class AccountFiscalYear(models.Model):
_name = "account.fiscal.year"
_inherit = [
"account.fiscal.year",
"fiscal.company.change.search.domain.mixin",
"fiscal.company.change.filtered.mixin",
"fiscal.company.check.company.mixin",
]

_fiscal_company_forbid_fiscal_type = ["fiscal_child", "group"]
1 change: 1 addition & 0 deletions fiscal_company_account_fiscal_year/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Sylvain LE GAL <https://twitter.com/legalsylvain>
8 changes: 8 additions & 0 deletions fiscal_company_account_fiscal_year/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This module extend Odoo functionnalities, regarding companies features to
manage CAE (Coopearatives of Activities and Employment) that is a special
status for french companies.

**Features**

* Add constrains on ``account.fiscal.year`` model
that prevent to create such items on a fiscal mother company.
21 changes: 21 additions & 0 deletions fiscal_company_account_fiscal_year/security/ir_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2024-Today GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->

<odoo>

<!-- account.fiscal.year -->
<!-- See the fiscal years of the fiscal mother company -->
<!-- OCA DEFAULT: ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] -->
<record id="rule_account_fiscal_year" model="ir.rule">
<field name="name">account.fiscal_year (fiscal_company_account_fiscal_year)</field>
<field name="model_id" ref="account_fiscal_year.model_account_fiscal_year"/>
<field name="domain_force">
[('company_id', 'in', user._include_fiscal_company_ids(company_ids))]
</field>
</record>

</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ef24170

Please sign in to comment.