From 91c427e2e9e781a41e2421a7252a82d4b76af705 Mon Sep 17 00:00:00 2001 From: RisvanaCybro Date: Wed, 19 Jun 2024 11:46:57 +0530 Subject: [PATCH] Jun 19: [FIX] Bug Fixed 'pos_analytic_tag' --- pos_analytic_tag/__manifest__.py | 8 ++--- pos_analytic_tag/doc/RELEASE_NOTES.md | 8 +++++ pos_analytic_tag/models/pos_session.py | 36 +++++++------------- pos_analytic_tag/static/src/js/PosSession.js | 12 +++---- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/pos_analytic_tag/__manifest__.py b/pos_analytic_tag/__manifest__.py index 97a243432..0881c237c 100644 --- a/pos_analytic_tag/__manifest__.py +++ b/pos_analytic_tag/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################### { 'name': "PoS Analytic Tag", - 'version': '17.0.1.0.0', + 'version': '17.0.1.0.1', 'category': 'Point of Sale', 'summary': 'To manage analytic tags in POS', 'description': "This module assists in managing analytic tags in the " @@ -31,7 +31,7 @@ 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', 'website': 'https://www.cybrosys.com', - 'depends': ['base', 'point_of_sale', 'analytic', 'account'], + 'depends': ['point_of_sale', 'analytic', 'account'], 'data': [ 'views/res_config_settings_views.xml', 'views/pos_config_views.xml', @@ -40,9 +40,9 @@ 'views/pos_payment_views.xml', ], 'assets': { - 'point_of_sale.assets': [ + 'point_of_sale._assets_pos': [ 'pos_analytic_tag/static/src/js/PosSession.js', - ] + ], }, 'images': ['static/description/banner.jpg'], 'license': 'AGPL-3', diff --git a/pos_analytic_tag/doc/RELEASE_NOTES.md b/pos_analytic_tag/doc/RELEASE_NOTES.md index bbc88aefa..6ab662bb5 100644 --- a/pos_analytic_tag/doc/RELEASE_NOTES.md +++ b/pos_analytic_tag/doc/RELEASE_NOTES.md @@ -4,3 +4,11 @@ #### Version 17.0.1.0.0 #### ADD - Initial Commit for PoS Analytic Tag + +## Module + +#### 19.06.2024 +#### Version 17.0.1.0.1 +#### BUGFIX + +- Updated the bug with analytic tag of the journal entries \ No newline at end of file diff --git a/pos_analytic_tag/models/pos_session.py b/pos_analytic_tag/models/pos_session.py index 598a04b1e..7d3e26f3a 100644 --- a/pos_analytic_tag/models/pos_session.py +++ b/pos_analytic_tag/models/pos_session.py @@ -41,28 +41,18 @@ class PosSession(models.Model): amount_to_balance, bank_payment_method_diffs) self.pos_analytic_account_id = self.config_id.analytic_account_id - for rec in self.move_id.line_ids: - rec.write({ - 'analytic_distribution': { - self.config_id.analytic_account_id.id: 100} - }) if self.pos_analytic_account_id: - self.env['account.analytic.distribution.model'].create([{ - 'analytic_distribution': { - self.config_id.analytic_account_id.id: 100} - }]) + for move in self._get_related_account_moves(): + for rec in move.line_ids: + rec.write({ + 'analytic_distribution': { + self.config_id.analytic_account_id.id: 100 + } + }) else: - return False - return res - - def _validate_session(self, balancing_account=False, amount_to_balance=0, - bank_payment_method_diffs=None): - res = super()._validate_session(balancing_account, amount_to_balance, - bank_payment_method_diffs) - ids = self.move_id.line_ids.open_reconcile_view() - for rec in self.env['account.move.line'].search(ids['domain']): - rec.write({ - 'analytic_distribution': { - self.config_id.analytic_account_id.id: 100} - }) - return res + for move in self._get_related_account_moves(): + for rec in move.line_ids: + rec.write({ + 'analytic_distribution': {} + }) + return res \ No newline at end of file diff --git a/pos_analytic_tag/static/src/js/PosSession.js b/pos_analytic_tag/static/src/js/PosSession.js index 2b6ff7a62..a1478c4eb 100644 --- a/pos_analytic_tag/static/src/js/PosSession.js +++ b/pos_analytic_tag/static/src/js/PosSession.js @@ -1,15 +1,13 @@ /** @odoo-module **/ /** - * Extends PosGlobalState and it extends Registries + * Extends PosStore and it extends Registries * Override the _processData method to process loaded data **/ -import { PosGlobalState} from 'point_of_sale.models'; -import Registries from 'point_of_sale.Registries'; - -const AnalyticAccount = (PosGlobalState) => class AnalyticAccount extends PosGlobalState { +import {patch} from "@web/core/utils/patch"; +import {PosStore} from "@point_of_sale/app/store/pos_store"; +patch(PosStore.prototype, { async _processData(loadedData) { await super._processData(...arguments); this.res_config_settings = loadedData['res.config.settings']; - } } -Registries.Model.extend(PosGlobalState, AnalyticAccount); \ No newline at end of file +}); \ No newline at end of file