Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort by Download and rating #46

Merged
merged 10 commits into from
Dec 6, 2018

Conversation

bizzappdev
Copy link

Added google recaptcha support for restricting Download.

@bizzappdev
Copy link
Author

Work in progress for the
Sort by options from website side

@oca-clabot
Copy link

Hey @bizzappdev, thank you for your Pull Request.

It looks like some users haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here: http://odoo-community.org/page/cla
Here is a list of the users:

Appreciation of efforts,
OCA CLAbot

Copy link

@elicoidal elicoidal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -6,6 +6,7 @@
odoo.define('website_apps_store.website_sale', function (require) {
'use strict';

console.log("222222222222@@")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably some cleansing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@elicoidal
Copy link

and bump version

@elicoidal
Copy link

@bizzappdev did you sign an enterprise CLA? This would cover your colleague

@bizzappdev
Copy link
Author

Yea we have signed from company.

@elicoidal
Copy link

Contact created and GH login associated to email. It should fix the CLA warning

@bizzappdev
Copy link
Author

Contact created and GH login associated to email. It should fix the CLA warning

added in hte GH login

@elicoidal
Copy link

added in hte GH login

actually unclear the login

@bizzappdev
Copy link
Author

@RoelAdriaans @oscarolar @StephanRozendaal can you please review

Copy link

@StephanRozendaal StephanRozendaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@elicoidal elicoidal merged commit ef302c3 into OCA:11.0 Dec 6, 2018
@elicoidal
Copy link

@sbidoul please deploy at your convenience

@bizzappdev
Copy link
Author

@sbidoul just make sure it has website_form_recaptcha in depends now so might be you have to configure the google recaptcha for that

@sbidoul
Copy link
Member

sbidoul commented Dec 6, 2018

@bizzappdev

might be you have to configure the google recaptcha for that

Do you have a pointer about how to do that?

@bizzappdev
Copy link
Author

bizzappdev commented Dec 6, 2018

@sbidoul
Configuration
Obtain ReCaptcha key from Google
Add site key to recaptcha.key.site system parameter
Add secret key to recaptcha.key.secret system parameter

reference: https://github.com/OCA/website/blob/11.0/website_form_recaptcha/README.rst#configuration
Note: this reference is just for how to get recaptcha and configure the system parameters in odoo. we do not have to do anything with the website form or model or anywhere else. do not consider the Usage part from RST.

@elicoidal
Copy link

@sbidoul I am not sure whether you could fully deploy this feature.
I have test in our shop now and there is no Captcha.

@bizzappdev
Copy link
Author

@sbidoul Let me know if you need a helping hand to deploy this.

@sbidoul
Copy link
Member

sbidoul commented Jan 12, 2019

@bizzappdev I've deployed this, and configured the recaptcha system parameters. The download button seems broken though. I don't immediately see why. Can you have a look? Here the js error:

image

@bizzappdev
Copy link
Author

Checking in 10 mins

@bizzappdev
Copy link
Author

@sbidoul I am not getting JS Error .
But seems like there is something strange.
on https://odoo-community.org/shop/download_product_zip/pos-report-session-summary-4598/.....
it is giving 500 error
if you can provide me log then I can investigate further.

@sbidoul
Copy link
Member

sbidoul commented Jan 12, 2019

Hm, on firefox I get the js error, on chrome error 500.

Here is the stack trace with chrome:

  File "/home/openerp/instance/odoo-community11/src/apps-store/website_apps_store/controllers/main.py", line 196, in download_product_zip
    self.validate_recaptcha(google_captcha)
  File "/home/openerp/instance/odoo-community11/src/apps-store/website_apps_store/controllers/main.py", line 181, in validate_recaptcha
    captcha_obj.action_validate(
AttributeError: 'website.form.recaptcha' object has no attribute 'action_validate'

@sbidoul
Copy link
Member

sbidoul commented Jan 12, 2019

@bizzappdev apparently website_form_recaptcha changed quite a bit recently: https://github.com/OCA/website/commits/11.0/website_form_recaptcha

@simahawk @mpanarin maybe you could advise if your recent changes were meant to be backward incompatible or if there is a wrong usage of the module here.

@bizzappdev
Copy link
Author

@sbidoul 500 error is because of OCA/website@f46d879#diff-f814babc2091d16e881f56ccf23ec954
not sure changing method name and parameters are allowed in stable version or not for OCA for ODOO it is not allowed.
should we take care of supporting as per new commit or how we should solve it? meanwhile, you can solve it by deploying older commit if you want.

@sbidoul
Copy link
Member

sbidoul commented Jan 12, 2019

@bizzappdev let's wait what @simahawk says about the api change in website_form_recaptcha

In the meantime I deployed OCA/website@f255902

  • the js error persists on firefox
  • with chrome I get a 403 access denied when downloading as an anonymous user

The acces error is at

  File "/home/openerp/instance/odoo-community11/src/apps-store/website_apps_store/controllers/main.py", line 215, in download_product_zip
    product.download_count = product.download_count + 1

@bizzappdev
Copy link
Author

1st fixed by #54 and for second #55 created
cc @sbidoul

@simahawk
Copy link

simahawk commented Jan 12, 2019

@bizzappdev @sbidoul using the captcha now:

        captcha_obj = request.env['website.form.recaptcha']
        try:
            captcha_obj.validate_request(
                request, kw.get(captcha_obj.RESPONSE_ATTR)
            )
        except ValidationError:
            # do what you want

the renaming happened because we have 2 validation methods, one for the request and one for the response.

Regarding "stable" version... well, we are not Odoo SA and if we (authors and reviewers) think the design is getting better we change it anyway w/out waiting for the next major release.
TBH I thought about proxing that method w/ the old name but then it disappeared in my mind 😝

That being said, if you think it can help, I can add a backward compat method that proxies the new one for v11.

JS has been refactored as well and it's easier now to customize it (it also fixes and issue w/ translations).

@elicoidal
Copy link

Thanks all for your help!

@elicoidal
Copy link

Tested and it works fine now

@pedrobaeza
Copy link
Member

@simahawk on OCA, we have relaxed rules about changing DB layout or API than Odoo, but that doesn't mean that you can break other modules by changing it in the middle of the version.

The proper thing to do is to provide the wrapper for compatibility and put a comment that it should be removed on next version migration, or make sure across all OCA that no other module is using it (which is difficult, so better option 1).

@simahawk
Copy link

@pedrobaeza you are right and as said I thought about it and forgot it. 😭
So, at the end, sorry for the trouble guys 😇

BTW I see there's no maturity flag here https://github.com/OCA/website/blob/11.0/website_crm_recaptcha/__manifest__.py
Shall we enforce this on all "old" modules and add a check on MQT to post a warning in PRs?
Dunno if this has been already discussed somewhere...
In any case let's move the discussion to MQT if needed.

@pedrobaeza
Copy link
Member

The maturity by default is beta, but it's very difficult to check that conditions without failing on false positive and negative cases and for me any maturity level except alpha should preserve this stability, so we should rely on the good will of the contributor and reviewers.

@simahawk
Copy link

ok, noted, tnx :)

victormmtorres pushed a commit to Tecnativa/apps-store that referenced this pull request Apr 30, 2019
* [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
victormmtorres pushed a commit to Tecnativa/apps-store that referenced this pull request May 2, 2019
* [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
victormmtorres pushed a commit to Tecnativa/apps-store that referenced this pull request May 6, 2019
* [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
Tardo pushed a commit to Tecnativa/apps-store that referenced this pull request Aug 5, 2020
* [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
pedrobaeza pushed a commit to Tecnativa/apps-store that referenced this pull request Aug 12, 2020
update products attributes and create attribute values (OCA#40)

* [FIX]update the product for the new version

* [FIX]max version problem and also rewrite logic so the from fronend if the version is not selected manually then the default(with less sequence) will be downloaded

* [IMP]added technical name search functionality

* change version number

* [IMP]Merged create and update product cron job

* [FIX]fix variable names

Fix Bad rendering of links inside README (OCA#42)

* [FIX][OCA#37]fix rendering from README

* [ADD]added CONTRIBUTORS

* [FIX] Sorting problem. sorted(for getting default version) as similar as it is sorted from website view

[FIX]visibility for the selected options and filters improvements (OCA#43)

* [FIX]visibility for the selection options and do not loss the selection option when we change filter from maturity to version etc.

* [VER]Added Version number

[FIX]CSS module description

[FIX]website_apps_store: fix the shop pager

[FIX][49] solve pager with search parameter (OCA#51)

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

11.0 issue OCA#50 add the module technical name in front page (OCA#52)

* [FIX][49] solve pager with search parameter

* [IMP]website_apps_store : add technical name in front page

* [IMP]website_apps_store : add website tour to search technical name

* [FIX]website_apps_store : add demo/product_template_demo.xml in menifest.py

[FIX] website product page event not define problem

[FIX]fix 403 public user error

[FIX]website_apps_store: attribute value change was not changing the href for the repository. OCA#56
ernestotejeda pushed a commit to Tecnativa/apps-store that referenced this pull request Aug 16, 2021
update products attributes and create attribute values (OCA#40)

* [FIX]update the product for the new version

* [FIX]max version problem and also rewrite logic so the from fronend if the version is not selected manually then the default(with less sequence) will be downloaded

* [IMP]added technical name search functionality

* change version number

* [IMP]Merged create and update product cron job

* [FIX]fix variable names

Fix Bad rendering of links inside README (OCA#42)

* [FIX][OCA#37]fix rendering from README

* [ADD]added CONTRIBUTORS

* [FIX] Sorting problem. sorted(for getting default version) as similar as it is sorted from website view

[FIX]visibility for the selected options and filters improvements (OCA#43)

* [FIX]visibility for the selection options and do not loss the selection option when we change filter from maturity to version etc.

* [VER]Added Version number

[FIX]CSS module description

[FIX]website_apps_store: fix the shop pager

[FIX][49] solve pager with search parameter (OCA#51)

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

11.0 issue OCA#50 add the module technical name in front page (OCA#52)

* [FIX][49] solve pager with search parameter

* [IMP]website_apps_store : add technical name in front page

* [IMP]website_apps_store : add website tour to search technical name

* [FIX]website_apps_store : add demo/product_template_demo.xml in menifest.py

[FIX] website product page event not define problem

[FIX]fix 403 public user error

[FIX]website_apps_store: attribute value change was not changing the href for the repository. OCA#56
ernestotejeda pushed a commit to Tecnativa/apps-store that referenced this pull request Aug 24, 2021
update products attributes and create attribute values (OCA#40)

* [FIX]update the product for the new version

* [FIX]max version problem and also rewrite logic so the from fronend if the version is not selected manually then the default(with less sequence) will be downloaded

* [IMP]added technical name search functionality

* change version number

* [IMP]Merged create and update product cron job

* [FIX]fix variable names

Fix Bad rendering of links inside README (OCA#42)

* [FIX][OCA#37]fix rendering from README

* [ADD]added CONTRIBUTORS

* [FIX] Sorting problem. sorted(for getting default version) as similar as it is sorted from website view

[FIX]visibility for the selected options and filters improvements (OCA#43)

* [FIX]visibility for the selection options and do not loss the selection option when we change filter from maturity to version etc.

* [VER]Added Version number

[FIX]CSS module description

[FIX]website_apps_store: fix the shop pager

[FIX][49] solve pager with search parameter (OCA#51)

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

11.0 issue OCA#50 add the module technical name in front page (OCA#52)

* [FIX][49] solve pager with search parameter

* [IMP]website_apps_store : add technical name in front page

* [IMP]website_apps_store : add website tour to search technical name

* [FIX]website_apps_store : add demo/product_template_demo.xml in menifest.py

[FIX] website product page event not define problem

[FIX]fix 403 public user error

[FIX]website_apps_store: attribute value change was not changing the href for the repository. OCA#56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants