-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
limit ref to 10c
- Loading branch information
matthieu.saison
committed
May 23, 2024
1 parent
3d8250a
commit 687bc89
Showing
15 changed files
with
231 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Secondary Analytic Account", | ||
"version": "14.0.1.0.0", | ||
"category": "Account", | ||
"license": "AGPL-3", | ||
"author": "Akretion", | ||
"website": "https://github.com/akretion/ak-odoo-incubator", | ||
"depends": ["account"], | ||
"data": [ | ||
"views/account_move_view.xml", | ||
"views/secondary_analytic_view.xml", | ||
"security/ir.model.access.csv", | ||
"security/analytic_security.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * secondary_analytic_account | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-05-07 14:09+0000\n" | ||
"PO-Revision-Date: 2024-05-07 14:09+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: secondary_analytic_account | ||
#: model:ir.model.fields,field_description:secondary_analytic_account.field_secondary_account_analytic_account__company_id | ||
msgid "Company" | ||
msgstr "Société" | ||
|
||
#. module: secondary_analytic_account | ||
#: model_terms:ir.ui.view,arch_db:secondary_analytic_account.view_secondary_account_analytic_account_list | ||
msgid "Name" | ||
msgstr "Nom" | ||
|
||
#. module: secondary_analytic_account | ||
#: model:ir.model.fields,field_description:secondary_analytic_account.field_secondary_account_analytic_account__code | ||
msgid "Reference" | ||
msgstr "Référence" | ||
|
||
#. module: secondary_analytic_account | ||
#: model:ir.model.fields,field_description:secondary_analytic_account.field_account_move_line__second_analytic_account_id | ||
#: model:ir.model.fields,field_description:secondary_analytic_account.field_secondary_account_analytic_account__name | ||
msgid "Secondary Analytic Account" | ||
msgstr "Compte analytique secondaire" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import account_move_line | ||
from . import secondary_analytic_account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class AccountMoveLine(models.Model): | ||
_inherit = "account.move.line" | ||
|
||
second_analytic_account_id = fields.Many2one( | ||
"secondary.account.analytic.account", | ||
string="Secondary Analytic Account", | ||
index=True, | ||
readonly=False, | ||
copy=True, | ||
) |
13 changes: 13 additions & 0 deletions
13
secondary_analytic_account/models/secondary_analytic_account.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class SecondaryAccountAnalyticAccount(models.Model): | ||
_name = "secondary.account.analytic.account" | ||
|
||
name = fields.Char( | ||
string="Secondary Analytic Account", index=True, required=True, tracking=True | ||
) | ||
code = fields.Char(string="Reference", index=True, tracking=True, size=10) | ||
company_id = fields.Many2one( | ||
"res.company", string="Company", default=lambda self: self.env.company | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Matthieu Saison <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module allows to have a secondary analytic account. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The use case is to add an other analytic axe in order to follow for exemple event cost or invest. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<data noupdate="1"> | ||
|
||
<record id="analytic_comp_rule" model="ir.rule"> | ||
<field name="name">Secondary Analytic multi company rule</field> | ||
<field name="model_id" ref="model_secondary_account_analytic_account" /> | ||
<field eval="True" name="global" /> | ||
<field | ||
name="domain_force" | ||
>['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> | ||
</record> | ||
|
||
</data> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_secondary_account_analytic_account,secondary.account.analytic.account.user,model_secondary_account_analytic_account,base.group_user,1,1,1,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<data> | ||
<record id="view_move_line_tree" model="ir.ui.view"> | ||
<field name="model">account.move.line</field> | ||
<field name="inherit_id" ref="account.view_move_line_tree" /> | ||
<field name="arch" type="xml"> | ||
<field name="analytic_account_id" position='after'> | ||
<field | ||
name="second_analytic_account_id" | ||
groups="account.group_account_readonly" | ||
optional="hide" | ||
/> | ||
</field> | ||
</field> | ||
</record> | ||
<record id="view_move_line_form" model="ir.ui.view"> | ||
<field name="model">account.move.line</field> | ||
<field name="inherit_id" ref="account.view_move_line_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="analytic_line_ids" position="after"> | ||
<group name="scd_analytic"> | ||
<field name="second_analytic_account_id" /> | ||
</group> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
|
||
<record id="view_move_form" model="ir.ui.view"> | ||
<field name="model">account.move</field> | ||
<field name="inherit_id" ref="account.view_move_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath | ||
expr="//page[@id='aml_tab']/field[@name='line_ids']/tree/field[@name='analytic_account_id']" | ||
position="after" | ||
> | ||
<field | ||
name="second_analytic_account_id" | ||
groups="analytic.group_analytic_accounting" | ||
optional="hide" | ||
attrs="{'invisible': [('display_type', 'in', ('line_section', 'line_note'))]}" | ||
/> | ||
</xpath> | ||
<xpath | ||
expr="//page[@id='aml_tab']/field[@name='line_ids']/form/group/field[@name='analytic_account_id']" | ||
position="after" | ||
> | ||
<field | ||
name="second_analytic_account_id" | ||
groups="analytic.group_analytic_accounting" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</data> | ||
</odoo> |
61 changes: 61 additions & 0 deletions
61
secondary_analytic_account/views/secondary_analytic_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="view_secondary_account_analytic_account_form" model="ir.ui.view"> | ||
<field name="model">secondary.account.analytic.account</field> | ||
<field name="arch" type="xml"> | ||
<form string="Analytic Account"> | ||
<sheet string="Analytic Account"> | ||
|
||
<div class="oe_title"> | ||
<label for="name" class="oe_edit_only" /> | ||
<h1> | ||
<field | ||
name="name" | ||
class="oe_inline" | ||
placeholder="e.g. Project XYZ" | ||
/> | ||
</h1> | ||
</div> | ||
<div name="project" /> | ||
<group name="main"> | ||
<group> | ||
<field name="code" /> | ||
<field | ||
name="company_id" | ||
groups="base.group_multi_company" | ||
/> | ||
</group> | ||
</group> | ||
</sheet> | ||
|
||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="view_secondary_account_analytic_account_list" model="ir.ui.view"> | ||
<field name="model">secondary.account.analytic.account</field> | ||
<field eval="8" name="priority" /> | ||
<field name="arch" type="xml"> | ||
<tree string="Analytic Accounts"> | ||
<field name="name" string="Name" /> | ||
<field name="code" /> | ||
<field name="company_id" groups="base.group_multi_company" /> | ||
</tree> | ||
</field> | ||
</record> | ||
|
||
<record id="action_secondary_analytic_account" model="ir.actions.act_window"> | ||
<field name="name">Secondary Analytic Account</field> | ||
<field name="res_model">secondary.account.analytic.account</field> | ||
<field name="view_mode">tree,form</field> | ||
</record> | ||
|
||
|
||
<menuitem | ||
id="menu_secondary_analytic_default_list" | ||
action="action_secondary_analytic_account" | ||
parent="account.menu_analytic_accounting" | ||
groups="analytic.group_analytic_accounting" | ||
sequence="4" | ||
/> | ||
</odoo> |
1 change: 1 addition & 0 deletions
1
setup/secondary_analytic_account/odoo/addons/secondary_analytic_account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../secondary_analytic_account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |