Skip to content

Commit

Permalink
[FIX] website_apps_store: Javascript WebsiteSale
Browse files Browse the repository at this point in the history
  • Loading branch information
Tardo committed Aug 23, 2019
1 parent 5588073 commit 598da7b
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 293 deletions.
20 changes: 0 additions & 20 deletions website_apps_store/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,26 +149,6 @@ def shop(self, page=0, category=None, search='', ppg=False, **post):
})
return res

@http.route(['/shop/change_attribute_version'], type='json',
auth="public", website=True)
def change_product_attribute_version(self, **kwargs):
product_id = kwargs.get('product_id', False)
product = request.env['product.product'].sudo().browse(product_id)
vals = {
'name_product': product.name,
'technical_name':
product.odoo_module_version_id.module_id.technical_name,
'license': product.app_license_id.name,
'license_url': product.app_license_id.website,
'author': ', '.join(
author.name for author in product.app_author_ids),
'website': product.app_website,
'repository': product.app_github_url,
'rst_html': product.app_description_rst_html,
'app_summary': product.app_summary,
}
return vals

def validate_recaptcha(self, captcha):
""" Function for validating Recaptcha """
captcha_obj = request.env['website.form.recaptcha']
Expand Down
38 changes: 38 additions & 0 deletions website_apps_store/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,41 @@ def get_version_info(self):
products = self.product_variant_ids.sorted(
lambda a: a.attribute_value_ids.sequence, reverse=True)
return products[0]

@api.multi
def _get_combination_info(self, combination=False, product_id=False,
add_qty=1, pricelist=False,
parent_combination=False, only_template=False):
vals = super()._get_combination_info(
combination=combination, product_id=product_id, add_qty=add_qty,
pricelist=pricelist, parent_combination=parent_combination,
only_template=only_template)
if not vals['product_id']:
return vals
product = self.env['product.product'].browse(vals['product_id'])
if product.odoo_module_id:
vals.update({
'is_odoo_module': True,
'name_product': product.name,
'technical_name':
product.odoo_module_version_id.module_id.technical_name,
'license': product.app_license_id.name,
'license_url': product.app_license_id.website,
'author': ', '.join(
author.name for author in product.app_author_ids),
'website': product.app_website,
'repository': product.app_github_url,
'rst_html': product.app_description_rst_html,
'app_summary': product.app_summary,
})
return vals

@api.multi
def _get_first_possible_combination(self, parent_combination=None,
necessary_values=None):
"""Override method to load last version first in app store"""
values = list(self._get_possible_combinations(
parent_combination, necessary_values))
if not any(values):
return self.env['product.template.attribute.value']
return values[-1]
5 changes: 5 additions & 0 deletions website_apps_store/static/src/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@
max-height: 15rem;
overflow-y: auto;
}

#product_details .col-form-label {
padding-top: 0;
padding-bottom: 0;
}
143 changes: 69 additions & 74 deletions website_apps_store/static/src/js/website_apps_store_tour.js
Original file line number Diff line number Diff line change
@@ -1,106 +1,101 @@
odoo.define('website_apps_store.tour_custom', function (require) {
'use strict';
'use strict';

var Tour = require("web_tour.tour");
var base = require("web_editor.base");
var Tour = require("web_tour.tour");
var base = require("web_editor.base");

Tour.register('download_zip', {
name: "Download Zip File",
url: '/shop/page/2',
test: true,
wait_for: base.ready()
},[
{
content: "Shop",
trigger: ".oe_product_cart a:contains('Odoo Module 1')"
wait_for: base.ready(),
}, [
{
content: "Shop",
trigger: ".oe_product_cart a:contains('Odoo Module 1')",
},
{
content: "Select Version",
trigger: "input[type=radio]",
run: function () {
$('input[type=radio]:last').attr("checked", "checked");
},
{
content: "Select Version",
trigger: "input[type=radio]",
run: function(){
$('input[type=radio]:last').attr("checked", "checked");
}
},
{
content: "Download",
trigger: "button:contains(Download)"
}
]
);
},
{
content: "Download",
trigger: "button:contains(Download)",
},
]);

Tour.register('select_version_search', {
name: "Select Version",
url: '/shop',
test: true,
wait_for: base.ready()
},[
{
content: "Shop",
trigger: ".dropdown_version_by a.dropdown-toggle"
},
{
content: "Select Version",
trigger: ".dropdown_version_by .dropdown-menu a:contains('10.0')",
},
]
);
wait_for: base.ready(),
}, [
{
content: "Shop",
trigger: ".dropdown_version_by a.dropdown-toggle",
},
{
content: "Select Version",
trigger: ".dropdown_version_by .dropdown-menu a:contains('10.0')",
},
]);

Tour.register('select_category_search', {
name: "Select Category",
url: '/shop',
test: true,
wait_for: base.ready()
},[
{
content: "Shop",
trigger: ".dropdown_category_by a.dropdown-toggle"
},
{
content: "Select Category",
trigger: ".dropdown_category_by .dropdown-menu a:contains('Category1')",
},
]
);
wait_for: base.ready(),
}, [
{
content: "Shop",
trigger: ".dropdown_category_by a.dropdown-toggle",
},
{
content: "Select Category",
trigger:
".dropdown_category_by .dropdown-menu a:contains('Category1')",
},
]);

Tour.register('module_search', {
name: "Select Product(Module)",
url: '/shop',
test: true,
wait_for: base.ready()
},[
{
content: "Shop",
trigger: ".search-query",
run: function(){
$('.search-query').attr('value', 'Test');
}
},
{
content: "Search Button",
trigger: ".oe_search_button",
wait_for: base.ready(),
}, [
{
content: "Shop",
trigger: ".search-query",
run: function () {
$('.search-query').attr('value', 'Test');
},
]
);
},
{
content: "Search Button",
trigger: ".oe_search_button",
},
]);

Tour.register('technical_name_search', {
name: "Select Product(Module) by Technical Name",
url: '/shop',
test: true,
wait_for: base.ready()
},[
{
content: "Shop",
trigger: ".search-query",
run: function(){
$('.search-query').attr('value', 'odoo_module1');
}
wait_for: base.ready(),
}, [
{
content: "Shop",
trigger: ".search-query",
run: function () {
$('.search-query').attr('value', 'odoo_module1');
},
{
content: "Search Button",
trigger: ".oe_search_button",
},
]
);

},
{
content: "Search Button",
trigger: ".oe_search_button",
},
]);

});
Loading

0 comments on commit 598da7b

Please sign in to comment.