forked from OCA/apps-store
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sort by Download and rating (OCA#46)
* [WIP] added initial support for Google recaptcha * [WIP]added dependencies * [IMP]Added google captcha with download functionality with reset and validation * [IMP]added download count fields and increament it when donwloaded * [ADD]added missing files * [IMP]website_apps_store: add sort by download count on website * remove console and not extra space * [VER]changed version number * [FIX]website_apps_store: fix test case error * [FIX]reset only if google recaptcha is initiated
- Loading branch information
1 parent
751cc29
commit 971d5aa
Showing
8 changed files
with
140 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import product | ||
from . import product_template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,10 @@ | ||
# Copyright (C) 2017-Today: Odoo Community Association (OCA) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models | ||
from odoo import models, fields | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = 'product.template' | ||
class ProductProduct(models.Model): | ||
_inherit = 'product.product' | ||
|
||
def get_author_details(self): | ||
author_ids = [] | ||
for variant in self.product_variant_ids: | ||
for author in variant.app_author_ids: | ||
if author not in author_ids: | ||
author_ids.append(author) | ||
return author_ids | ||
|
||
def get_version_info(self): | ||
products = self.product_variant_ids.sorted( | ||
lambda a: a.attribute_value_ids.sequence, reverse=True) | ||
return products[0] | ||
download_count = fields.Integer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (C) 2017-Today: Odoo Community Association (OCA) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields, api | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = 'product.template' | ||
|
||
@api.multi | ||
@api.depends('product_variant_ids', 'product_variant_ids.download_count') | ||
def _compute_total_download_count(self): | ||
for product in self: | ||
product.total_download_count = sum( | ||
product.mapped('product_variant_ids.download_count')) | ||
|
||
total_download_count = fields.Integer( | ||
compute="_compute_total_download_count", store=True) | ||
|
||
def get_author_details(self): | ||
author_ids = [] | ||
for variant in self.product_variant_ids: | ||
for author in variant.app_author_ids: | ||
if author not in author_ids: | ||
author_ids.append(author) | ||
return author_ids | ||
|
||
def get_version_info(self): | ||
products = self.product_variant_ids.sorted( | ||
lambda a: a.attribute_value_ids.sequence, reverse=True) | ||
return products[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters