Skip to content

[add] cms_form + cms_form_example#9

Merged
pedrobaeza merged 31 commits into
OCA:9.0from
simahawk:add-cms_form-PR
May 29, 2017
Merged

[add] cms_form + cms_form_example#9
pedrobaeza merged 31 commits into
OCA:9.0from
simahawk:add-cms_form-PR

Conversation

@simahawk

Copy link
Copy Markdown

CMS Form

Basic website contents form framework. Allows to define front-end forms for every models in a simple way.

If you are tired of re-defining every time an edit form or a search form for your odoo website,
this is the module you are looking for.

Features

  • automatic form generation (create, write, search)

  • automatic route generation (create, write, search)

  • automatic machinery based on fields' type:

    • widget rendering
    • field value load (from existing instance or from request)
    • field value extraction (from request)
    • field value write (to existing instance)
  • highly customizable

  • works with every odoo model

  • works also without any model

  • add handy attributes to models inheriting from website.published.mixin:

    • cms_add_url: lead to create form view. By default /cms/form/create/my.model
    • cms_edit_url: lead to edit form view. By default /cms/form/edit/my.model/model_id
    • cms_search_url: lead to search form view. By default /cms/form/search/my.model

(extracted from official README)

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.3%) to 84.748% when pulling 3d73c7b on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.3%) to 84.748% when pulling 3d73c7b on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

@simahawk

Copy link
Copy Markdown
Author

@lasley @yajo as usual, when you have time.... :)

PS: is it possible to configure test coverage checks to ignore some stuff, like cms_form_example module?

@lasley lasley added this to the 9.0 milestone Feb 16, 2017
@lasley

lasley commented Feb 17, 2017

Copy link
Copy Markdown

PS: is it possible to configure test coverage checks to ignore some stuff, like cms_form_example module?

Few different ways - in your instance prolly the coveragerc file would be best.

My warning is to not go excluding things all over the place because it's really just covering up a problem. Anything not tested is a ticking timebomb IMO.

That said, we're definitely fine ignoring an example module.

@coveralls

coveralls commented Feb 17, 2017

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.3%) to 84.748% when pulling 1144cd1 on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

Comment thread .coveragerc Outdated
@@ -0,0 +1,4 @@
[run]

@lasley lasley Feb 17, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

well, the docs do not mention [report] here https://coverage.readthedocs.io/en/coverage-4.2/source.html#execution
anyway, I updated it as per your example, but is still looking for cms_form_example.
Better look at this tomorrow, instead of checking it in the middle of my baby's bath 😄

@lasley lasley Feb 17, 2017

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 looked further and it looks like coveragerc isn't an option because the template is being used instead. It would probably be best to just use

# pragma: no cover

near the top of the python files then 😦

@coveralls

coveralls commented Feb 17, 2017

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.3%) to 84.748% when pulling 05f2816 on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

@lasley

lasley commented Feb 28, 2017

Copy link
Copy Markdown

@tedsalmon please review

@tedsalmon tedsalmon 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.

👍 Awesome work! I have some minor review items, mostly import related stuff that caught my eye :)

Comment thread cms_form/models/cms_form.py Outdated
# Copyright 2017 Simone Orsi
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A little nit picky but these imports are not ordered alphabetically as OCA guidelines ask. Perhaps you'd consider importing in a single line?

from openerp import _, exceptions, models

from ..utils import DEFAULT_LOADERS, DEFAULT_EXTRACTORS
from ..import widgets

import inspect

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These imports should be above the Odoo import

Comment thread cms_form/models/cms_form_mixin.py Outdated
value = extractor(self, fname, value, **request_values)
if value is None:
# we assume we do not want to override the field value.
# a tipical example is an image 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.

s/tipical/typical

Comment thread cms_form/models/cms_search_form.py Outdated
def form_search_domain(self, search_values):
"""Build search domain.

TODO...

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What's TODO here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

well: explain how we build domain and maybe improve it a little bit.

Comment thread cms_form/models/test_models.py Outdated
# Copyright 2017 Simone Orsi
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Alphabetical import order, again :)

Comment thread cms_form/tests/__init__.py Outdated
from . import test_form_search
from . import test_form_render
from . import test_loaders
from . import test_controllers

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Import alphabetically :)

Comment thread cms_form/tests/test_controllers.py Outdated
from .common import fake_request
from .common import FormHttpTestCase
from ..controllers import main
import mock

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These should be above your local imports

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@tedsalmon tnx! I'll go trough them.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.2%) to 84.82% when pulling 26ed9c4 on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.2%) to 84.82% when pulling 26ed9c4 on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

@coveralls

coveralls commented Mar 2, 2017

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.2%) to 84.82% when pulling 26ed9c4 on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

@coveralls

coveralls commented Mar 6, 2017

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.4%) to 84.579% when pulling 7dc324b on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

@guewen guewen 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.

Wow

Comment thread cms_form/README.rst Outdated
if extra_values.get('notify_partner'):
# do what you want here...

``notifiy_partner`` will be included into the form but it will be discarded on create and write.

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/notifiy/notify/g

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.4%) to 84.579% when pulling 3546f26 on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.4%) to 84.579% when pulling 3546f26 on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

@coveralls

coveralls commented Mar 10, 2017

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-10.4%) to 84.579% when pulling 3546f26 on simahawk:add-cms_form-PR into 4514cbe on OCA:9.0.

@lasley

lasley commented Mar 10, 2017

Copy link
Copy Markdown

@simahawk - Did you have any plans to up the test coverage?

@lasley

lasley commented May 15, 2017

Copy link
Copy Markdown

@simahawk - I set this to WIP because commits are still being added. Let us know when it's ready for review again.

@simahawk

Copy link
Copy Markdown
Author

@lasley yes pls :) I'm still cleaning/fixing/adding small improvements and I'll move widgets to models.
Hopefully we can close this during or after the sprint in Barcelona (I will attend remotely).

@simahawk

Copy link
Copy Markdown
Author

@lasley I'd say that after this 6f7a594 we can rebase and merge :)
About coverage: I'd like to improve it during the sprint next week but to ease partecipation is better to merge this before so that we already have a "kinda stable" starting point.

@simahawk

Copy link
Copy Markdown
Author

BTW I'll re-license already merged modules in a separated PR

@simahawk

simahawk commented May 29, 2017

Copy link
Copy Markdown
Author

@pedrobaeza would you mind hit the button here? I'll improve test cov later, probably tomorrow.
Needs rebase of course...

@pedrobaeza
pedrobaeza merged commit 8258504 into OCA:9.0 May 29, 2017
@simahawk
simahawk deleted the add-cms_form-PR branch May 30, 2017 13:04
simahawk added a commit to simahawk/website-cms that referenced this pull request Oct 2, 2017
simahawk added a commit to simahawk/website-cms that referenced this pull request Oct 2, 2017
simahawk added a commit to simahawk/website-cms that referenced this pull request Oct 2, 2017
simahawk added a commit to simahawk/website-cms that referenced this pull request Oct 18, 2017
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.

6 participants