Skip to content

Migration to version 11.0 - #12

Merged
yvaucher merged 11 commits into
OCA:11.0from
bizzappdev:11.0-migration-apps-store
Sep 28, 2018
Merged

yvaucher merged 11 commits into
OCA:11.0from
bizzappdev:11.0-migration-apps-store

Conversation

@bizzappdev

Copy link
Copy Markdown

Migration to version 11.0 as per the request at #4

@oca-clabot

Copy link
Copy Markdown

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/website.cla
Here is a list of the users:

  • Divya Modi (no github login found)

Appreciation of efforts,
OCA CLAbot

@pedrobaeza pedrobaeza added this to the 11.0 milestone Sep 5, 2018
@bizzappdev

bizzappdev commented Sep 5, 2018

Copy link
Copy Markdown
Author

@elicoidal here is a PR for the v11.
Also, I would like to inform that BizzAppDev Company did the ECLA so IMO all the commits from @bizzappdev.com have to have the CLA. I man not sure. let me know if I have to do something special.

there was one bug/error (from interface-github) which was causing the Odoo module/version do not have the icon so the products did not have Icons.

the Bug will be solved once the OCA/interface-git#19 will be approved and merged.

@elicoidal

Copy link
Copy Markdown

@bizzappdev thanks for the PR.
For the ECLA, I will have a look but I need a github login to add it to your account (it is missing from the bot message).
cc @gdgellatly @OCA/board review welcome

@elicoidal elicoidal left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@bizzappdev Thanks for your contribution!
No real technical review on my side. Some questions though

Comment thread apps_download/__manifest__.py Outdated
@@ -0,0 +1,27 @@
# Copyright 2017 BizzAppDev

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

add 2018 in all copyrights

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

no need <data>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

add copyright

Comment thread apps_download/models/product_product.py Outdated

@api.multi
def generate_zip_file(self):
product1 = self.env.ref('apps_download.product_product_100')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am a little bit confused by this piece of code: what do you intend to do with the tests data?
I would suggest at least some docstrings to the function and short comments in the code.

@@ -0,0 +1,4 @@

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove line

Comment thread apps_product_creator/models/product_product.py
},
{
content: "Select Author",
trigger: ".dropdown_author_by .dropdown-menu a:contains('OCA')",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I prefer not to have OCA hard-coded.
We should set up somewhere the organization and use it here

Comment thread website_apps_store/static/src/js/website_apps_store_tour.js
Comment thread website_apps_store/static/src/js/website_sale.js
Comment thread website_apps_store/views/assets.xml Outdated
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="assets_frontend" name="Website Apps Store" inherit_id="website.assets_frontend">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

please improve readbility with one line per attribute

Comment thread website_apps_store/views/templates.xml Outdated
<xpath expr='//a[hasclass("js_check_product")]' position="attributes">
<attribute name="t-if">not product.odoo_module_id</attribute>
</xpath>
<!--xpath expr="//hr" position="attributes">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove dead code

@bizzappdev

Copy link
Copy Markdown
Author

@elicoidal All requests have been taken care.

@bizzappdev

Copy link
Copy Markdown
Author

might be @pedrobaeza or @RoelAdriaans can do a technical review?

@elicoidal

Copy link
Copy Markdown

@OCA/board @gdgellatly Technical review welcome.

@max3903 max3903 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@elicoidal Apart from splitting the README.rst, LGTM
👍

@yvaucher yvaucher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hello,

Thanks for the porting.

I'm a bit concerned about the purpose of apps_download module. It seems like it is a Proof of concept with demo data. What is in folder demo is not loaded as demo but really seems to be demo data.

I would advise to put the load of this file under demo key and make sure the method can be used without thoses data.

Otherwise you will find few other tiny remarks on the python code.

Comment thread apps_download/__manifest__.py Outdated
],
"summary": "Product Download for Appstore",
"data": [
'demo/product_template_demo.xml',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be under demo key loading this setup only in case of an instance with without_demo=False ?

Comment thread apps_download/models/product_product.py Outdated
Comment thread apps_download/README.rst
if self._check_related_to_module(product):
attribute = self._get_version_attribute(values)
version = self._get_version_with_attribute(
version_ids = self._get_version_with_attribute(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here you renamed version to version_ids but _get_version_with_attribute returns you a record set.
To not mix with actual integer ids, I suggest you to rename version_ids to versions

'odoo_module_version_id': version.id,
})
for version in version_ids:
module_id = version.module_id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s/module_id/module

It preferable to not use suffix _id when the variable is a record set.

Comment thread website_apps_store/controllers/main.py Outdated
url = "/shop/category/%s" % slug(category)

category_all = request.env['product.public.category'].search([])
versions = request.env['product.attribute.value'].search([])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be filtered by attribute_id = ref('apps_product_creator.attribute_odoo_version') ? If an other product.attribute was created it would be confusing. product.attribute can be a lot of things.

Comment thread apps_download/data/cron_scheduler.xml Outdated
-->
<odoo>
<record id="ir_cron_scheduler_generate_zip" model="ir.cron">
<field name="name">Generate all product zip</field>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Generate ZIP files for all products

<page string="Module Dependency">
<separator string="Modules Dependency" colspan="4"/>
<field name="dependent_product_ids" colspan="4" nolabel="1"/>
<button string="Get all Dependency" type="object" name="generate_zip_file"/>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dependencies

var base = require("web_editor.base");

Tour.register('download_zip', {
name: "Download Product Zip",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Download ZIP file

@elicoidal

Copy link
Copy Markdown

@bizzappdev have you had a chance to check the review?
@gdgellatly do we have a possibility to test it in our newly migrated v11?

@gdgellatly

Copy link
Copy Markdown

@elicoidal I think @sbidoul and @pedrobaeza are organizing the test instance. Just been a bit delayed with holidays.

@sbidoul

sbidoul commented Sep 18, 2018

Copy link
Copy Markdown
Member

@gdgellatly the test environment is ready now.

@bizzappdev

Copy link
Copy Markdown
Author

@elicoidal all the requested changes are done.

@elicoidal

Copy link
Copy Markdown

@yvaucher could you please have a second look?

@yvaucher

Copy link
Copy Markdown
Member

@bizzappdev I added more question on your reply, I get that you need some setup for the PhantomJS tests, but it seems it adds an action and a cron that won't work as they can only launch the test version of the method, or is it supposed to be overwritten somewhere?

Don't hesitate also to write a more complete Pull request's description if some context must be known by the reviewers.

@yvaucher yvaucher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here is an example on how to mock the definition of the module_path for your test purpose.

Didn't tested it but should give you a proper way to do it.

super(TestUi, self).setUp()
self.tour = "odoo.__DEBUG__.services['web_tour.tour']"

def test_download_zip_tour(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You probably want to do the following:

In generate_zip_files extract this in an other method name _get_module_path:

 module_path = product.module_path + '/'\
                + product.odoo_module_version_id.technical_name

to get it like that:

module_path = product._get_module_path()

Then you need to mock this method to return your special test path:

[...]
import mock

mock_get_module_path = (
    'openerp.addons.apps_download.models.product.ProductProduct._get_module_path'
) # it might be odoo.addons in v11 to check

[...]

    def test_download_zip_tour(self):
        with mock.patch(mock_get_module_path) as mock_func:
            mock_func.return_value = <your test path string>
            self.phantom_js('/shop', ...)

@bizzappdev

Copy link
Copy Markdown
Author

@yvaucher Thank you so much, I was not aware of the mock. we have implemented that as per your example.

@bizzappdev

Copy link
Copy Markdown
Author

@yvaucher anything else has to be taken care?

@yvaucher

yvaucher commented Sep 28, 2018

Copy link
Copy Markdown
Member

@bizzappdev thanks for the change, LGTM

@yvaucher
yvaucher merged commit 2317ae6 into OCA:11.0 Sep 28, 2018
@pedrobaeza pedrobaeza mentioned this pull request Sep 28, 2018
2 tasks
@elicoidal

Copy link
Copy Markdown

Thanks all!
We will set it up during the code sprint

@bizzappdev

Copy link
Copy Markdown
Author

@elicoidal yes sure, that will be great. I will be also around.

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.

8 participants