From 93de63c290c3e81a7212cc5020b05dfc6630dd04 Mon Sep 17 00:00:00 2001 From: Quentin Mondot Date: Wed, 8 Oct 2025 18:02:21 +0200 Subject: [PATCH 1/3] [ADD] copy paste module account_sub_accounts from version 16.0 and updated version to 18.0 --- account_sub_accounts/README.rst | 51 +++++++++++++++++++ account_sub_accounts/__init__.py | 1 + account_sub_accounts/__manifest__.py | 21 ++++++++ .../i18n/account_sub_accounts.pot | 45 ++++++++++++++++ account_sub_accounts/i18n/fr.po | 45 ++++++++++++++++ account_sub_accounts/models/__init__.py | 2 + .../models/account_move_line.py | 15 ++++++ account_sub_accounts/models/res_parter.py | 8 +++ .../views/account_move_line_views.xml | 16 ++++++ .../views/res_partner_views.xml | 18 +++++++ 10 files changed, 222 insertions(+) create mode 100644 account_sub_accounts/README.rst create mode 100644 account_sub_accounts/__init__.py create mode 100644 account_sub_accounts/__manifest__.py create mode 100644 account_sub_accounts/i18n/account_sub_accounts.pot create mode 100644 account_sub_accounts/i18n/fr.po create mode 100644 account_sub_accounts/models/__init__.py create mode 100644 account_sub_accounts/models/account_move_line.py create mode 100644 account_sub_accounts/models/res_parter.py create mode 100644 account_sub_accounts/views/account_move_line_views.xml create mode 100644 account_sub_accounts/views/res_partner_views.xml diff --git a/account_sub_accounts/README.rst b/account_sub_accounts/README.rst new file mode 100644 index 0000000..4977746 --- /dev/null +++ b/account_sub_accounts/README.rst @@ -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 `_. 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. diff --git a/account_sub_accounts/__init__.py b/account_sub_accounts/__init__.py new file mode 100644 index 0000000..9a7e03e --- /dev/null +++ b/account_sub_accounts/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/account_sub_accounts/__manifest__.py b/account_sub_accounts/__manifest__.py new file mode 100644 index 0000000..932c28c --- /dev/null +++ b/account_sub_accounts/__manifest__.py @@ -0,0 +1,21 @@ +{ + 'name': 'Account Sub-accounts', + 'version': '18.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': {}, +} diff --git a/account_sub_accounts/i18n/account_sub_accounts.pot b/account_sub_accounts/i18n/account_sub_accounts.pot new file mode 100644 index 0000000..4d5c87f --- /dev/null +++ b/account_sub_accounts/i18n/account_sub_accounts.pot @@ -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 "" diff --git a/account_sub_accounts/i18n/fr.po b/account_sub_accounts/i18n/fr.po new file mode 100644 index 0000000..50b2d1a --- /dev/null +++ b/account_sub_accounts/i18n/fr.po @@ -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 18.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" diff --git a/account_sub_accounts/models/__init__.py b/account_sub_accounts/models/__init__.py new file mode 100644 index 0000000..d5b2a53 --- /dev/null +++ b/account_sub_accounts/models/__init__.py @@ -0,0 +1,2 @@ +from . import res_parter +from . import account_move_line diff --git a/account_sub_accounts/models/account_move_line.py b/account_sub_accounts/models/account_move_line.py new file mode 100644 index 0000000..3a17f7b --- /dev/null +++ b/account_sub_accounts/models/account_move_line.py @@ -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" + ) diff --git a/account_sub_accounts/models/res_parter.py b/account_sub_accounts/models/res_parter.py new file mode 100644 index 0000000..610ec59 --- /dev/null +++ b/account_sub_accounts/models/res_parter.py @@ -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") diff --git a/account_sub_accounts/views/account_move_line_views.xml b/account_sub_accounts/views/account_move_line_views.xml new file mode 100644 index 0000000..a5ca318 --- /dev/null +++ b/account_sub_accounts/views/account_move_line_views.xml @@ -0,0 +1,16 @@ + + + + + Account Move Line sub-accounts tree view + account.move.line + + + + + + + + + + diff --git a/account_sub_accounts/views/res_partner_views.xml b/account_sub_accounts/views/res_partner_views.xml new file mode 100644 index 0000000..739512a --- /dev/null +++ b/account_sub_accounts/views/res_partner_views.xml @@ -0,0 +1,18 @@ + + + + + Res Partner sub-accounts form view + res.partner + + + + + + + + + + + + -- 2.49.1 From 64b8e45af12e380023851832263995bae05f3bb9 Mon Sep 17 00:00:00 2001 From: Quentin Mondot Date: Wed, 8 Oct 2025 18:25:03 +0200 Subject: [PATCH 2/3] [IMP] account_sub_accounts : apply changes proposed by pre-commit --- account_sub_accounts/__init__.py | 2 +- account_sub_accounts/__manifest__.py | 35 ++++++++++--------- .../models/account_move_line.py | 6 ++-- .../views/account_move_line_views.xml | 26 +++++++------- .../views/res_partner_views.xml | 30 ++++++++-------- 5 files changed, 47 insertions(+), 52 deletions(-) diff --git a/account_sub_accounts/__init__.py b/account_sub_accounts/__init__.py index 9a7e03e..0650744 100644 --- a/account_sub_accounts/__init__.py +++ b/account_sub_accounts/__init__.py @@ -1 +1 @@ -from . import models \ No newline at end of file +from . import models diff --git a/account_sub_accounts/__manifest__.py b/account_sub_accounts/__manifest__.py index 932c28c..52ae62c 100644 --- a/account_sub_accounts/__manifest__.py +++ b/account_sub_accounts/__manifest__.py @@ -1,21 +1,22 @@ { - 'name': 'Account Sub-accounts', - 'version': '18.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', + "name": "Account Sub-accounts", + "version": "18.0.1.0.0", + "summary": "Add sub-account fields in res.partners and account.move.line, " + "and sync them.", + "author": "Elabore", + "website": "https://git.elabore.coop/elabore/account-tools", + "license": "AGPL-3", + "category": "Accounting", + "depends": [ + "account", + "base", ], - 'data': [ - 'views/res_partner_views.xml', - 'views/account_move_line_views.xml', + "data": [ + "views/res_partner_views.xml", + "views/account_move_line_views.xml", ], - 'installable': True, - 'auto_install': False, - 'application': False, - 'assets': {}, + "installable": True, + "auto_install": False, + "application": False, + "assets": {}, } diff --git a/account_sub_accounts/models/account_move_line.py b/account_sub_accounts/models/account_move_line.py index 3a17f7b..a3657b7 100644 --- a/account_sub_accounts/models/account_move_line.py +++ b/account_sub_accounts/models/account_move_line.py @@ -5,11 +5,9 @@ class AccountMoveLine(models.Model): _inherit = "account.move.line" sub_account_customer = fields.Char( - string="Custommer sub-account", - related="partner_id.sub_account_customer" + 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" + string="Supplier sub-account", related="partner_id.sub_account_supplier" ) diff --git a/account_sub_accounts/views/account_move_line_views.xml b/account_sub_accounts/views/account_move_line_views.xml index a5ca318..8735344 100644 --- a/account_sub_accounts/views/account_move_line_views.xml +++ b/account_sub_accounts/views/account_move_line_views.xml @@ -1,16 +1,14 @@ - + - - - Account Move Line sub-accounts tree view - account.move.line - - - - - - - - - + + Account Move Line sub-accounts tree view + account.move.line + + + + + + + + diff --git a/account_sub_accounts/views/res_partner_views.xml b/account_sub_accounts/views/res_partner_views.xml index 739512a..a36ecb7 100644 --- a/account_sub_accounts/views/res_partner_views.xml +++ b/account_sub_accounts/views/res_partner_views.xml @@ -1,18 +1,16 @@ - + - - - Res Partner sub-accounts form view - res.partner - - - - - - - - - - - + + Res Partner sub-accounts form view + res.partner + + + + + + + + + + -- 2.49.1 From bb6891d825547d37229b52450d2711cfb39309a0 Mon Sep 17 00:00:00 2001 From: Quentin Mondot Date: Wed, 8 Oct 2025 18:52:21 +0200 Subject: [PATCH 3/3] update gitignore to ignore Ruff cache directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 551cb32..856a2bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.*~ *.pyc +.ruff_cache/ -- 2.49.1