Skip to content

Commit

Permalink
[MIG] fiscal_company_base: Migration to 16.0 (from 12.0)
Browse files Browse the repository at this point in the history
- full refactor of code.
- create a dedicated OCA/multi-company module 'res_company_access_all_childs' to isolate code.
  • Loading branch information
legalsylvain committed Aug 4, 2024
1 parent a54b906 commit dfba0a5
Show file tree
Hide file tree
Showing 24 changed files with 495 additions and 624 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ repos:
rev: v0.1.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
- id: ruff-format
- repo: https://github.com/OCA/pylint-odoo
rev: v8.0.19
Expand Down
2 changes: 0 additions & 2 deletions fiscal_company_base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from . import models

from .post_install import post_install_set_fiscal_company
13 changes: 5 additions & 8 deletions fiscal_company_base/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@

{
"name": "CAE - Base",
"version": "12.0.1.2.3",
"version": "16.0.1.0.0",
"category": "CAE",
"summary": "Manage CAE (Cooperatives of Activities and Employment)",
"author": "GRAP",
"website": "https://github.com/grap/odoo-addons-cae",
"license": "AGPL-3",
"post_init_hook": "post_install_set_fiscal_company",
"depends": [
"base",
# GRAP
"technical_partner_access",
# Dependency added to have the possibility to create demo user,
# without "notification_type" error
"mail",
],
"data": [
"security/ir_module_category.xml",
"security/res_groups.xml",
"security/ir_rule.xml",
"security/ir.model.access.csv",
# "security/ir_rule.xml",
"views/view_res_company.xml",
],
"demo": [
Expand Down
38 changes: 0 additions & 38 deletions fiscal_company_base/demo/res_groups.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,9 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record id="base.group_user" model="res.groups">
<field name="users" eval="[
(4, ref('user_worker')),
(4, ref('user_accountant')),
]"/>
</record>

<record id="base.group_multi_currency" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_admin')),
(4, ref('user_accountant')),
]"/>
</record>

<record id="base.group_partner_manager" model="res.groups">
<field name="users" eval="[
(4, ref('user_accountant')),
]"/>
</record>

<record id="base.group_multi_company" model="res.groups">
<field name="users" eval="[
(4, ref('user_accountant')),
]"/>
</record>

<record id="base.group_erp_manager" model="res.groups">
<field name="users" eval="[
(4, ref('user_accountant')),
]"/>
</record>

<record id="fiscal_company_manager" model="res.groups">
<field name="users" eval="[
(4, ref('user_accountant')),
(4, ref('base.user_admin')),
]"/>
</record>

<record id="base.group_no_one" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_admin')),
]"/>
</record>
Expand Down
2 changes: 0 additions & 2 deletions fiscal_company_base/demo/res_partner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Copyright (C) 2018-Today GRAP (http://www.grap.coop)
<record id="partner_mother" model="res.partner">
<field name="name">CAE - Mother Partner</field>
<field name="company_id" ref="company_fiscal_mother"/>
<field name="customer" eval="True"/>
<field name="supplier" eval="True"/>
</record>

</odoo>
44 changes: 19 additions & 25 deletions fiscal_company_base/demo/res_partner_company.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,70 +8,64 @@ Copyright (C) 2015-Today GRAP (http://www.grap.coop)

<odoo>

<!-- Updating base.main_company-->
<!--
Note, we set the main company as a french company to avoid the
installation of l10n_generic_coa if account is installad.
see addons/account/__init__.py
-->
<!-- Create Main Group company and partner associated -->
<record model="res.partner" id="partner_group">
<field name="name">Group Company</field>
<field name="company_id" eval="False"/>
<field name="is_company" eval="True"/>
</record>

<record model="res.company" id="company_group">
<field name="name">Group Company</field>
<field name="partner_id" ref="partner_group"/>
<field name="fiscal_type">group</field>
</record>

<!-- Set Group as the parent of the default demo company -->
<record model="res.company" id="base.main_company">
<field name="fiscal_company_id" ref="base.main_company" />
<field name="country_id" ref="base.fr"/>
<field name="parent_id" ref="company_group" />
</record>

<!-- Create fiscal mother company and partner associated -->
<record model="res.partner" id="partner_fiscal_mother">
<field name="name">Your Mother Company</field>
<field name="company_id" eval="None"/>
<field name="company_id" eval="False"/>
<field name="is_company" eval="True"/>
</record>

<record model="res.company" id="company_fiscal_mother">
<field name="name">Your Mother Company</field>
<field name="partner_id" ref="partner_fiscal_mother"/>
<field name="fiscal_type">fiscal_mother</field>
</record>

<record model="res.partner" id="partner_fiscal_mother">
<field name="company_id" ref="company_fiscal_mother"/>
<field name="parent_id" ref="company_group" />
</record>

<!-- Create fiscal child company 1 and partner associated -->
<record model="res.partner" id="partner_fiscal_child_1">
<field name="name">Your Child Company 1 (Service)</field>
<field name="company_id" eval="None"/>
<field name="company_id" eval="False"/>
<field name="is_company" eval="True"/>
</record>

<record model="res.company" id="company_fiscal_child_1">
<field name="name">Your Child Company 1 (Service)</field>
<field name="partner_id" ref="partner_fiscal_child_1"/>
<field name="parent_id" ref="company_fiscal_mother" />
<field name="fiscal_company_id" ref="company_fiscal_mother"/>
<field name="fiscal_type">fiscal_child</field>
</record>

<record model="res.partner" id="partner_fiscal_child_1">
<field name="company_id" ref="company_fiscal_child_1"/>
</record>

<!-- Create fiscal child company 2 and partner associated -->
<record model="res.partner" id="partner_fiscal_child_2">
<field name="name">Your Child Company 2 (Production)</field>
<field name="company_id" eval="None"/>
<field name="company_id" eval="False"/>
<field name="is_company" eval="True"/>
</record>

<record model="res.company" id="company_fiscal_child_2">
<field name="name">Your Child Company 2 (Production)</field>
<field name="partner_id" ref="partner_fiscal_child_2"/>
<field name="parent_id" ref="company_fiscal_mother" />
<field name="fiscal_company_id" ref="company_fiscal_mother"/>
<field name="fiscal_type">fiscal_child</field>
</record>

<record model="res.partner" id="partner_fiscal_child_2">
<field name="company_id" ref="company_fiscal_child_2"/>
</record>

</odoo>
9 changes: 0 additions & 9 deletions fiscal_company_base/demo/res_partner_users.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ Copyright (C) 2015-Today GRAP (http://www.grap.coop)
<record model="res.partner" id="partner_accountant">
<field name="name">Accountant User</field>
<field name="email">[email protected]</field>
<field name="customer" eval="False"/>
<field name="supplier" eval="False"/>
<field name="company_id" eval="False"/>
<field name="active" eval="True"/>
</record>

<record model="res.users" id="user_accountant">
Expand All @@ -42,10 +38,6 @@ Copyright (C) 2015-Today GRAP (http://www.grap.coop)
<record model="res.partner" id="partner_worker">
<field name="name">Worker User</field>
<field name="email">[email protected]</field>
<field name="customer" eval="False"/>
<field name="supplier" eval="False"/>
<field name="company_id" eval="False"/>
<field name="active" eval="True"/>
</record>

<record model="res.users" id="user_worker">
Expand All @@ -58,5 +50,4 @@ Copyright (C) 2015-Today GRAP (http://www.grap.coop)
]"/>
</record>


</odoo>
43 changes: 0 additions & 43 deletions fiscal_company_base/fix_test.py

This file was deleted.

Loading

0 comments on commit dfba0a5

Please sign in to comment.