[NEW] account_sub_account: create add-on

This commit is contained in:
Stéphan Sainléger
2025-04-25 10:30:24 +02:00
parent 09f0eaac18
commit 847f5a6317
10 changed files with 222 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
====================
account_sub_accounts
====================
Add sub-account fields in res.partners and account.move.line, and sync them.
Installation
============
Use Odoo normal module installation procedure to install
``account_sub_account``.
Description
===========
- adds sub_account_customer and sub_account_supplier to res.partner model
- adds sub_account_customer and sub_account_supplier to account.move.line model
- when a account.move.line is created, sub_account_customer and sub_account_supplier fields are sync with the parner_id corresponding values
Known issues / Roadmap
======================
None yet.
Bug Tracker
===========
Bugs are tracked on `our issues website <https://github.com/elabore-coop/account-tools/issues>`_. In case of
trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Stéphan Sainléger - https://github.com/stephansainleger
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by Elabore.

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,21 @@
{
'name': 'Account Sub-accounts',
'version': '16.0.1.0.0',
'summary': 'Add sub-account fields in res.partners and account.move.line, and sync them.',
'author': 'Elabore',
'website': 'https://elabore.coop/',
'license': 'AGPL-3',
'category': 'Accounting',
'depends': [
'account',
'base',
],
'data': [
'views/res_partner_views.xml',
'views/account_move_line_views.xml',
],
'installable': True,
'auto_install': False,
'application': False,
'assets': {},
}

View File

@@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_sub_accounts
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-25 08:27+0000\n"
"PO-Revision-Date: 2025-04-25 08:27+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: account_sub_accounts
#: model:ir.model,name:account_sub_accounts.model_res_partner
msgid "Contact"
msgstr ""
#. module: account_sub_accounts
#: model:ir.model.fields,field_description:account_sub_accounts.field_account_move_line__sub_account_customer
#: model:ir.model.fields,field_description:account_sub_accounts.field_res_partner__sub_account_customer
#: model:ir.model.fields,field_description:account_sub_accounts.field_res_users__sub_account_customer
msgid "Custommer sub-account"
msgstr ""
#. module: account_sub_accounts
#: model:ir.model,name:account_sub_accounts.model_account_move_line
msgid "Journal Item"
msgstr ""
#. module: account_sub_accounts
#: model_terms:ir.ui.view,arch_db:account_sub_accounts.res_partner_form_sub_accounts_view
msgid "Sub-accounts"
msgstr ""
#. module: account_sub_accounts
#: model:ir.model.fields,field_description:account_sub_accounts.field_account_move_line__sub_account_supplier
#: model:ir.model.fields,field_description:account_sub_accounts.field_res_partner__sub_account_supplier
#: model:ir.model.fields,field_description:account_sub_accounts.field_res_users__sub_account_supplier
msgid "Supplier sub-account"
msgstr ""

View File

@@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_sub_accounts
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-25 08:29+0000\n"
"PO-Revision-Date: 2025-04-25 10:30+0200\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: account_sub_accounts
#: model:ir.model,name:account_sub_accounts.model_res_partner
msgid "Contact"
msgstr ""
#. module: account_sub_accounts
#: model:ir.model.fields,field_description:account_sub_accounts.field_account_move_line__sub_account_customer
#: model:ir.model.fields,field_description:account_sub_accounts.field_res_partner__sub_account_customer
#: model:ir.model.fields,field_description:account_sub_accounts.field_res_users__sub_account_customer
msgid "Custommer sub-account"
msgstr "Compte auxiliaire client"
#. module: account_sub_accounts
#: model:ir.model,name:account_sub_accounts.model_account_move_line
msgid "Journal Item"
msgstr "Écriture comptable"
#. module: account_sub_accounts
#: model_terms:ir.ui.view,arch_db:account_sub_accounts.res_partner_form_sub_accounts_view
msgid "Sub-accounts"
msgstr "Comptes auxiliaires"
#. module: account_sub_accounts
#: model:ir.model.fields,field_description:account_sub_accounts.field_account_move_line__sub_account_supplier
#: model:ir.model.fields,field_description:account_sub_accounts.field_res_partner__sub_account_supplier
#: model:ir.model.fields,field_description:account_sub_accounts.field_res_users__sub_account_supplier
msgid "Supplier sub-account"
msgstr "Compte auxiliaire fournisseur"

View File

@@ -0,0 +1,2 @@
from . import res_parter
from . import account_move_line

View File

@@ -0,0 +1,15 @@
from odoo import fields, models
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
sub_account_customer = fields.Char(
string="Custommer sub-account",
related="partner_id.sub_account_customer"
)
sub_account_supplier = fields.Char(
string="Supplier sub-account",
related="partner_id.sub_account_supplier"
)

View File

@@ -0,0 +1,8 @@
from odoo import fields, models
class Partner(models.Model):
_inherit = "res.partner"
sub_account_customer = fields.Char(string="Custommer sub-account")
sub_account_supplier = fields.Char(string="Supplier sub-account")

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="account_move_line_tree_sub_accounts_view" model="ir.ui.view">
<field name="name">Account Move Line sub-accounts tree view</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='analytic_distribution']" position="after">
<field name="sub_account_customer" optional="hide"/>
<field name="sub_account_supplier" optional="hide"/>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="res_partner_form_sub_accounts_view" model="ir.ui.view">
<field name="name">Res Partner sub-accounts form view</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account.view_partner_property_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='accounting']/group" position="inside">
<group string="Sub-accounts" name="sub_accounts">
<field name="sub_account_customer" />
<field name="sub_account_supplier" />
</group>
</xpath>
</field>
</record>
</data>
</odoo>