chore: update Theme Alan version to 18.0.1.0, refactor RPC service usage across components, and enhance header/footer snippet configurations

This commit is contained in:
hoangvv
2026-08-14 10:52:51 +07:00
parent 49226d0343
commit 62ca567ea4
19 changed files with 58 additions and 39 deletions
@@ -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);
}
@@ -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){
@@ -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');
})
@@ -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);
@@ -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 = [];
@@ -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() });
@@ -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();
@@ -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 });
@@ -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 () {
@@ -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
@@ -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
@@ -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){
@@ -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;
@@ -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