diff --git a/pos_sale_order_analytic_by_config/__init__.py b/pos_sale_order_analytic_by_config/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/pos_sale_order_analytic_by_config/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_sale_order_analytic_by_config/__manifest__.py b/pos_sale_order_analytic_by_config/__manifest__.py new file mode 100644 index 0000000..48c17da --- /dev/null +++ b/pos_sale_order_analytic_by_config/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2022 Akretion (https://www.akretion.com). +# @author Pierrick Brun +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "POS Sale order Analytic by Config", + "version": "14.0.1.0.0", + "category": "Point Of Sale", + "author": "Akretion", + "website": "https://github.com/akretion/pos-sale-order", + "license": "AGPL-3", + "depends": [ + "pos_sale_order", + "pos_analytic_by_config", + ], + "data": [], + "qweb": [], + "demo": [], + "installable": True, + "auto_install": True, +} diff --git a/pos_sale_order_analytic_by_config/models/__init__.py b/pos_sale_order_analytic_by_config/models/__init__.py new file mode 100644 index 0000000..6aacb75 --- /dev/null +++ b/pos_sale_order_analytic_by_config/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order diff --git a/pos_sale_order_analytic_by_config/models/sale_order.py b/pos_sale_order_analytic_by_config/models/sale_order.py new file mode 100644 index 0000000..7aca681 --- /dev/null +++ b/pos_sale_order_analytic_by_config/models/sale_order.py @@ -0,0 +1,15 @@ +# Copyright 2022 Akretion (https://www.akretion.com). +# @author Pierrick Brun +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + def _compute_analytic_account_id(self): + super()._compute_analytic_account_id() + for record in self: + if record.config_id and record.config_id.account_analytic_id: + record.analytic_account_id = record.config_id.account_analytic_id diff --git a/pos_sale_order_analytic_by_config/readme/DESCRIPTION.rst b/pos_sale_order_analytic_by_config/readme/DESCRIPTION.rst new file mode 100644 index 0000000..340b829 --- /dev/null +++ b/pos_sale_order_analytic_by_config/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Glue module to make pos_analytic_by_config work with pos_sale_order diff --git a/setup/pos_sale_order_analytic_by_config/odoo/addons/pos_sale_order_analytic_by_config b/setup/pos_sale_order_analytic_by_config/odoo/addons/pos_sale_order_analytic_by_config new file mode 120000 index 0000000..c3b659c --- /dev/null +++ b/setup/pos_sale_order_analytic_by_config/odoo/addons/pos_sale_order_analytic_by_config @@ -0,0 +1 @@ +../../../../pos_sale_order_analytic_by_config \ No newline at end of file diff --git a/setup/pos_sale_order_analytic_by_config/setup.py b/setup/pos_sale_order_analytic_by_config/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/pos_sale_order_analytic_by_config/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)