From 62ca567ea49eda9647b8e749d7cbd8c55778b297 Mon Sep 17 00:00:00 2001 From: hoangvv Date: Fri, 14 Aug 2026 10:52:51 +0700 Subject: [PATCH] chore: update Theme Alan version to 18.0.1.0, refactor RPC service usage across components, and enhance header/footer snippet configurations --- theme_alan/__manifest__.py | 3 ++- theme_alan/controllers/controllers.py | 3 +-- theme_alan/static/src/js/AlanTouch/AlanTouch.js | 3 ++- .../src/js/components/FrameData/frame_data.js | 3 ++- .../src/js/components/FrameMaker/frame_maker.js | 4 ++-- .../js/components/FramePreview/frame_preview.js | 4 ++-- .../src/js/components/SelectData/select_data.js | 3 ++- .../components/SnippetBuilder/snippet_builder.js | 3 ++- .../static/src/js/frontend/website_front.js | 7 ++++--- .../static/src/js/frontend/website_product.js | 5 +++-- .../static/src/js/frontend/website_sale.js | 16 +++++++++------- .../DynamicSnippets/best_selling/best_selling.js | 4 ++-- .../latest_product/latest_product.js | 4 ++-- theme_alan/static/src/js/snippets/Hotspot/000.js | 3 ++- .../static/src/js/snippets/Hotspot/options.js | 3 ++- .../js/snippets/Megamenu/category/m_category.js | 5 +++-- theme_alan/views/headers_footers/options.xml | 4 ++-- theme_alan/views/snippets/s_dynamic.xml | 7 ++++--- theme_alan/views/snippets/s_website_builder.xml | 13 ++++++++++--- 19 files changed, 58 insertions(+), 39 deletions(-) diff --git a/theme_alan/__manifest__.py b/theme_alan/__manifest__.py index bdab36be4..9f3c385a9 100644 --- a/theme_alan/__manifest__.py +++ b/theme_alan/__manifest__.py @@ -2,7 +2,7 @@ { 'name': "Theme Alan", 'category': 'Theme/eCommerce', - 'version': '1.0', + 'version': '18.0.1.0', 'license': 'OPL-1', 'author': 'Atharva System', 'support': 'support@atharvasystem.com', @@ -90,4 +90,5 @@ 'currency': 'EUR', 'images': ['static/description/alan_description.jpg','static/description/alan_screenshot.gif'], 'application': False, + 'installable': True, } diff --git a/theme_alan/controllers/controllers.py b/theme_alan/controllers/controllers.py index f4623b93c..5c8fce039 100644 --- a/theme_alan/controllers/controllers.py +++ b/theme_alan/controllers/controllers.py @@ -17,7 +17,6 @@ from odoo.addons.auth_signup.models.res_users import SignupError from odoo.addons.website_sale.controllers.main import WebsiteSale, TableCompute from odoo.addons.website_sale.controllers.variant import WebsiteSaleVariantController from odoo.addons.website.controllers.main import Website -from odoo.addons.http_routing.models.ir_http import slug _logger = logging.getLogger(__name__) @@ -108,7 +107,7 @@ class WebsiteSaleAlanShop(WebsiteSale): res = super(WebsiteSaleAlanShop, self).shop(page, category, search, min_price, max_price, ppg, **post) url = '/shop' if category: - url = "/shop/category/%s" % slug(category) + url = "/shop/category/%s" % request.env['ir.http']._slug(category) as_search_prds = res.qcontext['search_product'] # Load More if request.website.active_load_more: diff --git a/theme_alan/static/src/js/AlanTouch/AlanTouch.js b/theme_alan/static/src/js/AlanTouch/AlanTouch.js index da8fc035d..b2a53d470 100644 --- a/theme_alan/static/src/js/AlanTouch/AlanTouch.js +++ b/theme_alan/static/src/js/AlanTouch/AlanTouch.js @@ -5,6 +5,7 @@ import { useService } from '@web/core/utils/hooks'; import { Dialog } from "@web/core/dialog/dialog"; import { _t } from '@web/core/l10n/translation'; +import { rpc } from "@web/core/network/rpc"; const { Component, onWillStart } = owl; class AlanConfigDialog extends Dialog {} @@ -19,7 +20,7 @@ AlanConfigDialog.defaultProps = { class AlanConfiguration extends Component { setup(){ - this.rpc = useService("rpc"); + this.rpc = rpc; onWillStart(this._fetch_configuration); } diff --git a/theme_alan/static/src/js/components/FrameData/frame_data.js b/theme_alan/static/src/js/components/FrameData/frame_data.js index 4176281f5..473147a8b 100644 --- a/theme_alan/static/src/js/components/FrameData/frame_data.js +++ b/theme_alan/static/src/js/components/FrameData/frame_data.js @@ -5,12 +5,13 @@ import { SnippetBox } from 'theme_alan.SnippetBox'; import { useService } from "@web/core/utils/hooks"; import { UserInformDialog } from "theme_alan.UserInformDialog" +import { rpc } from "@web/core/network/rpc"; const { Component, onMounted } = owl; class FrameData extends Component { setup(){ this.dialog = useService("dialog"); - this._rpc = useService("rpc"); + this._rpc = rpc; onMounted(() => { /** Mount the frame */ if(this.env.SnippetBuilder.PreviewframeTemplate != false){ diff --git a/theme_alan/static/src/js/components/FrameMaker/frame_maker.js b/theme_alan/static/src/js/components/FrameMaker/frame_maker.js index cf7f86df1..377072fee 100644 --- a/theme_alan/static/src/js/components/FrameMaker/frame_maker.js +++ b/theme_alan/static/src/js/components/FrameMaker/frame_maker.js @@ -1,7 +1,7 @@ /** @odoo-module alias=theme_alan.FrameMaker **/ -import { useService } from "@web/core/utils/hooks"; +import { rpc } from "@web/core/network/rpc"; const { Component, useState, useSubEnv, onMounted, onWillStart } = owl; class FrameOption extends Component { @@ -161,7 +161,7 @@ class DefaultFrame extends Component { /** shows all the alan default and custom frame */ setup(){ - this.rpc = useService("rpc"); + this.rpc = rpc; onWillStart(async()=>{ this.data = await this.rpc('/get_default_frame'); }) diff --git a/theme_alan/static/src/js/components/FramePreview/frame_preview.js b/theme_alan/static/src/js/components/FramePreview/frame_preview.js index 605ba4d3a..05c05d6b6 100644 --- a/theme_alan/static/src/js/components/FramePreview/frame_preview.js +++ b/theme_alan/static/src/js/components/FramePreview/frame_preview.js @@ -1,14 +1,14 @@ /** @odoo-module alias=theme_alan.FramePreview **/ -import { useService } from "@web/core/utils/hooks"; import { alanTemplate } from "theme_alan.mixins"; +import { rpc } from "@web/core/network/rpc"; const { Component, onMounted } = owl; class FramePreview extends Component { setup(){ /** setup method */ - this.rpc = useService("rpc"); + this.rpc = rpc; onMounted(async ()=>{ let $preview_template = await this.env.SnippetBuilder._getPreviewframeTemplate(false) $(this.__owl__.bdom.parentEl).find(".as-preview-section").empty().append($preview_template); diff --git a/theme_alan/static/src/js/components/SelectData/select_data.js b/theme_alan/static/src/js/components/SelectData/select_data.js index 9170e3b09..8de078883 100644 --- a/theme_alan/static/src/js/components/SelectData/select_data.js +++ b/theme_alan/static/src/js/components/SelectData/select_data.js @@ -5,6 +5,7 @@ import { _t } from "@web/core/l10n/translation"; import { useService } from "@web/core/utils/hooks"; import { UserInformDialog } from 'theme_alan.UserInformDialog'; +import { rpc } from "@web/core/network/rpc"; const { Component, useState, onMounted } = owl; class SelectData extends Component { @@ -12,7 +13,7 @@ class SelectData extends Component { // Initlized data of snippets.... this.dialog = useService("dialog"); this.state = useState({'record_info':[], 'record_ids':[]}) - this.rpc = useService("rpc"); + this.rpc = rpc; this.design_editor = useState(this.props.design_and_edit); this.bindedSortable = []; diff --git a/theme_alan/static/src/js/components/SnippetBuilder/snippet_builder.js b/theme_alan/static/src/js/components/SnippetBuilder/snippet_builder.js index 8da475be5..9ccd383fd 100644 --- a/theme_alan/static/src/js/components/SnippetBuilder/snippet_builder.js +++ b/theme_alan/static/src/js/components/SnippetBuilder/snippet_builder.js @@ -1,6 +1,7 @@ /** @odoo-module alias=theme_alan.SnippetBuilder **/ import { useService } from "@web/core/utils/hooks"; +import { rpc } from "@web/core/network/rpc"; // import { useWowlService } from '@web/legacy/utils'; import { Dialog } from "@web/core/dialog/dialog"; import { FrameMaker } from "theme_alan.FrameMaker"; @@ -22,7 +23,7 @@ class SnippetBuilder extends Component { setup() { /** setup method */ - this.rpc = useService("rpc"); + this.rpc = rpc; useSubEnv({'SnippetBuilder':this}); onWillStart(this.initlized); this.state = useState({ active_component: this._get_state() }); diff --git a/theme_alan/static/src/js/frontend/website_front.js b/theme_alan/static/src/js/frontend/website_front.js index 4da3520c1..ac8976d13 100644 --- a/theme_alan/static/src/js/frontend/website_front.js +++ b/theme_alan/static/src/js/frontend/website_front.js @@ -3,6 +3,7 @@ import publicWidget from "@web/legacy/js/public/public_widget"; import VariantMixin from "@website_sale/js/variant_mixin"; import wSaleUtils from "@website_sale/js/website_sale_utils"; +import { rpc } from "@web/core/network/rpc"; const cartHandlerMixin = wSaleUtils.cartHandlerMixin; publicWidget.registry.MegaMenuTabsSnippets = publicWidget.Widget.extend({ @@ -39,7 +40,7 @@ publicWidget.registry.MegaMenuSnippets = publicWidget.Widget.extend({ }, init: function () { this._super.apply(this, arguments); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, _showMegaMenu: async function(ev){ if(!this.is_clicked && !this.editableMode){ @@ -75,7 +76,7 @@ publicWidget.registry.MegaMenuSnippets = publicWidget.Widget.extend({ let AlanSliders = publicWidget.Widget.extend({ init: function () { this._super.apply(this, arguments); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, _getProductSlider:function(){ for (const product_slider of this.$target) { @@ -174,7 +175,7 @@ publicWidget.registry.AlanAddCart = publicWidget.Widget.extend(cartHandlerMixin, }, init: function () { this._super.apply(this, arguments); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, _addToCart:function(ev){ ev.preventDefault(); diff --git a/theme_alan/static/src/js/frontend/website_product.js b/theme_alan/static/src/js/frontend/website_product.js index 06b65a7f3..c0c97f37b 100644 --- a/theme_alan/static/src/js/frontend/website_product.js +++ b/theme_alan/static/src/js/frontend/website_product.js @@ -3,6 +3,7 @@ import Dialog from '@web/legacy/js/core/dialog'; import publicWidget from "@web/legacy/js/public/public_widget"; +import { rpc } from "@web/core/network/rpc"; export const ProductDetailInfo = publicWidget.Widget.extend({ selector:".as-product-detail", events:{ @@ -13,7 +14,7 @@ export const ProductDetailInfo = publicWidget.Widget.extend({ }, init: function () { this._super.apply(this, arguments); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, start: function () { new Swiper(".as-al-ass-swiper", { @@ -121,7 +122,7 @@ let AlanAdvanceInfo = Dialog.extend({ renderHeader: false, renderFooter: false, }); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, willStart: async function () { var template = this.rpc('/get_advance_info', { advance_info_id: this.advance_info_id }); diff --git a/theme_alan/static/src/js/frontend/website_sale.js b/theme_alan/static/src/js/frontend/website_sale.js index f3d334cff..1d509ddb8 100644 --- a/theme_alan/static/src/js/frontend/website_sale.js +++ b/theme_alan/static/src/js/frontend/website_sale.js @@ -7,10 +7,12 @@ import '@website_sale_wishlist/js/website_sale_wishlist'; import '@website_sale_comparison/js/website_sale_comparison'; import { _t } from '@web/core/l10n/translation'; import { debounce } from "@web/core/utils/timing"; -const { DateTime } = luxon; +import { rpc } from "@web/core/network/rpc"; import { deserializeDateTime, formatDateTime } from "@web/core/l10n/dates"; import VariantMixin from "@website_sale/js/variant_mixin"; +const { DateTime } = luxon; + // Color Variant Icon >--------------------------------- const ColorVariantDetails = Dialog.extend({ init(ele, otps) { @@ -23,7 +25,7 @@ const ColorVariantDetails = Dialog.extend({ renderHeader: true, renderFooter: false, }); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, willStart: async function () { var template = this.rpc('/get_color_product', { product_id: this.product_id }); @@ -74,7 +76,7 @@ const AlanSimilarProduct = Dialog.extend({ renderHeader: false, renderFooter: false, }); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, willStart: async function () { var template = this.rpc('/get_similar_product', { product_id: this.product_id }); @@ -140,7 +142,7 @@ let LoginPopup = Dialog.extend({ renderHeader: false, renderFooter: false, }, otps); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, willStart: async function(){ var template = this.rpc('/get_login_popup', {'test':'test'}); @@ -230,7 +232,7 @@ const AlanQuickView = Dialog.extend({ renderHeader: false, renderFooter: false, }); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, QuickViewLOad:function(){ var self = this @@ -275,7 +277,7 @@ export const AjaxProductLoad = publicWidget.Widget.extend({ init: function () { this._super.apply(this, arguments); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, InitLoadProducts:function(){ @@ -561,7 +563,7 @@ const AlanMiniCartProduct = Dialog.extend({ renderHeader: false, renderFooter: false, }); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; this._changeCartQuantity = debounce(this._changeCartQuantity.bind(this), 500); }, willStart: async function () { diff --git a/theme_alan/static/src/js/snippets/DynamicSnippets/best_selling/best_selling.js b/theme_alan/static/src/js/snippets/DynamicSnippets/best_selling/best_selling.js index 47c77fcb1..f35284a60 100644 --- a/theme_alan/static/src/js/snippets/DynamicSnippets/best_selling/best_selling.js +++ b/theme_alan/static/src/js/snippets/DynamicSnippets/best_selling/best_selling.js @@ -1,14 +1,14 @@ /** @odoo-module alias=theme_alan.BestSellingProduct **/ -import { useService } from "@web/core/utils/hooks"; import { SelectData } from "theme_alan.SelectData"; +import { rpc } from "@web/core/network/rpc"; const { Component, useSubEnv, onWillStart } = owl; class BestSellingProduct extends Component { setup(){ /** Setup Method */ - this._rpc = useService("rpc"); + this._rpc = rpc; onWillStart(this._get_best_selling_product) // Required to go back diff --git a/theme_alan/static/src/js/snippets/DynamicSnippets/latest_product/latest_product.js b/theme_alan/static/src/js/snippets/DynamicSnippets/latest_product/latest_product.js index a9553762d..2aa6cb645 100644 --- a/theme_alan/static/src/js/snippets/DynamicSnippets/latest_product/latest_product.js +++ b/theme_alan/static/src/js/snippets/DynamicSnippets/latest_product/latest_product.js @@ -1,14 +1,14 @@ /** @odoo-module alias=theme_alan.LatestProduct **/ -import { useService } from "@web/core/utils/hooks"; import { SelectData } from "theme_alan.SelectData"; +import { rpc } from "@web/core/network/rpc"; const { Component, useSubEnv, onWillStart } = owl; class LatestProduct extends Component { setup(){ /** Setup Method */ - this._rpc = useService("rpc"); + this._rpc = rpc; onWillStart(this._get_latest_product) // Required to go back diff --git a/theme_alan/static/src/js/snippets/Hotspot/000.js b/theme_alan/static/src/js/snippets/Hotspot/000.js index 6e0d46bb6..c82023f05 100644 --- a/theme_alan/static/src/js/snippets/Hotspot/000.js +++ b/theme_alan/static/src/js/snippets/Hotspot/000.js @@ -4,11 +4,12 @@ import publicWidget from "@web/legacy/js/public/public_widget"; import { renderToElement } from "@web/core/utils/render"; import Dialog from '@web/legacy/js/core/dialog'; +import { rpc } from "@web/core/network/rpc"; export const ImgHotSpot = publicWidget.Widget.extend({ selector:'.hotspot', init: function () { this._super.apply(this, arguments); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, start:function(ev){ diff --git a/theme_alan/static/src/js/snippets/Hotspot/options.js b/theme_alan/static/src/js/snippets/Hotspot/options.js index ebdad14ba..790052949 100644 --- a/theme_alan/static/src/js/snippets/Hotspot/options.js +++ b/theme_alan/static/src/js/snippets/Hotspot/options.js @@ -6,6 +6,7 @@ import { renderToElement } from "@web/core/utils/render"; import Dialog from '@web/legacy/js/core/dialog'; import { loadLanguages,_t } from "@web/core/l10n/translation"; +import { rpc } from "@web/core/network/rpc"; var popoverShow = false; options.SnippetOptionWidget.include({ @@ -58,7 +59,7 @@ options.registry.img_hotspots_slider_actions = options.Class.extend({ }, init: function () { this._super.apply(this, arguments); - this.rpc = this.bindService("rpc"); + this.rpc = rpc; }, _set_hotspot_translation : async function(ev){ var cr = this; diff --git a/theme_alan/static/src/js/snippets/Megamenu/category/m_category.js b/theme_alan/static/src/js/snippets/Megamenu/category/m_category.js index d78bdbc0d..97446e751 100644 --- a/theme_alan/static/src/js/snippets/Megamenu/category/m_category.js +++ b/theme_alan/static/src/js/snippets/Megamenu/category/m_category.js @@ -5,6 +5,7 @@ import { alanTemplate } from "theme_alan.mixins"; import { useService } from "@web/core/utils/hooks"; import { SelectData } from "theme_alan.SelectData"; +import { rpc } from "@web/core/network/rpc"; const { Component, useSubEnv, onMounted, useState } = owl; class SubCategory extends Component { @@ -14,7 +15,7 @@ class SubCategory extends Component { this.header = true; this.search = "product.public.category" this.props.selected_cat = []; - this.rpc = useService("rpc"); + this.rpc = rpc; onMounted(this._select2); } @@ -94,7 +95,7 @@ class MegaMenuCategory extends Component { this.subCategory = useState({'second_level':[],'second_level_ids':[]}); // dialog subcategory this.dialog = useService("dialog"); - this.rpc = useService("rpc"); + this.rpc = rpc; // Search this.props.search = "product.public.category"; // Quick Search Option diff --git a/theme_alan/views/headers_footers/options.xml b/theme_alan/views/headers_footers/options.xml index 1459ee8aa..7bd8ed939 100644 --- a/theme_alan/views/headers_footers/options.xml +++ b/theme_alan/views/headers_footers/options.xml @@ -3,7 +3,7 @@