Начальное наполнение

This commit is contained in:
parent 02ec9ba7d0
commit d887a4955c
6 changed files with 110 additions and 0 deletions

2
__init__.py Normal file
View File

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

25
__manifest__.py Normal file
View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Product Availability Notifications',
'category': 'Website/Website',
'summary': 'Bridge module for Website sale comparison and wishlist',
'description': """
It allows for comparing products from the wishlist
""",
'depends': [
'website_sale_comparison',
'website_sale_wishlist',
],
'data': [
'views/templates.xml',
],
'assets': {
'web.assets_frontend': [
'website_sale_comparison_wishlist/static/src/**/*',
],
},
'auto_install': True,
'license': 'LGPL-3',
}

23
i18n/ru.po Normal file
View File

@ -0,0 +1,23 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_comparison_wishlist
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-26 21:56+0000\n"
"PO-Revision-Date: 2024-01-30 15:14+0400\n"
"Last-Translator: \n"
"Language-Team: Russian (https://app.transifex.com/odoo/teams/41243/ru/)\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#. module: website_sale_comparison_wishlist
#: model_terms:ir.ui.view,arch_db:website_sale_comparison_wishlist.product_wishlist
msgid "Add to compare"
msgstr "Добавить к сравнению"

View File

@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_comparison_wishlist
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-26 21:56+0000\n"
"PO-Revision-Date: 2023-10-26 21:56+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: website_sale_comparison_wishlist
#: model_terms:ir.ui.view,arch_db:website_sale_comparison_wishlist.product_wishlist
msgid "Add to compare"
msgstr ""

23
static/src/js/wishlist.js Normal file
View File

@ -0,0 +1,23 @@
/** @odoo-module **/
import publicWidget from '@web/legacy/js/public/public_widget';
import '@website_sale_comparison/js/website_sale_comparison';
publicWidget.registry.ProductComparison.include({
events: Object.assign({}, publicWidget.registry.ProductComparison.prototype.events, {
'click .wishlist-section .o_add_to_compare': '_onClickCompare',
}),
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* @private
* @param {Event} ev
*/
_onClickCompare: function (ev) {
const productID = parseInt(ev.currentTarget.dataset.productId, 10);
this.productComparison._addNewProducts(productID);
},
});

16
views/templates.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="product_wishlist" inherit_id="website_sale_wishlist.product_wishlist">
<xpath expr="//button[hasclass('o_wish_rm')]" position="after">
<t t-set="categories" t-value="wish.product_id.product_tmpl_id.valid_product_template_attribute_line_ids._prepare_categories_for_display()"/>
<t t-set="product_variant_id" t-value="wish.product_id.product_tmpl_id._get_first_possible_variant_id()"/>
<button
t-if="is_view_active('website_sale_comparison.add_to_compare') and product_variant_id and categories"
type="button"
class="btn btn-link o_add_to_compare no-decoration"
t-att-data-product-id='wish.product_id.id'>
<small><i t-attf-class="fa fa-exchange"></i> Add to compare</small>
</button>
</xpath>
</template>
</odoo>