Skip to content

Commit

Permalink
[10.0][ADD] website_form_builder: Exactly what the title says (#402)
Browse files Browse the repository at this point in the history
* [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says

* fixup! [ADD] website_form_builder: Exactly what the title says
  • Loading branch information
yajo authored and rafaelbn committed Feb 2, 2018
1 parent 28910f7 commit 94c9f12
Show file tree
Hide file tree
Showing 19 changed files with 1,830 additions and 0 deletions.
138 changes: 138 additions & 0 deletions website_form_builder/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3

====================
Website Form Builder
====================

This module provides websites the feature of adding custom forms in any page.

Installation
============

Install some other addon that provides ``website_form`` support to
benefit from this one's features. Hints:

* ``website_crm``
* ``website_form_project``
* ``website_hr_recruitment``
* ``website_sale``

Configuration
=============

To configure this module, you need to:

#. Have *Administration / Settings* privileges.
#. Go to *Settings > Activate developer mode*.
#. Go to *Settings > Technical > Database Structure > Models*.
#. Search for the model you want to manage website form access for.
#. When you find it, it will have a *Website Forms* section where you can:

* Allow the model to get forms, by checking *Allowed to use in forms*.
* Give the model forms a better name in *Label for form action*.
* Choose the field where to store custom fields data in *Field for custom
form data*. If you leave this one empty and the model is a mail thread,
a new message will be appended with that custom data.

#. In the *Fields* tab, there's a new column called *Blacklisted in web forms*.
It's a security feature that forbids form submitters to write to those
fields. When you create a new website form, all its model fields are
automatically whitelisted for the sake of improving the UX. If you want to
have higher control, come back here after creating the form and blacklist
any fields you want, although that will only work for custom fields.

Usage
=====

To use this module, you need to:

#. Go to any of your website pages.
#. Edit it.
#. Drag and drop the *Form* snippet into the page.
#. Use the snippet overlay to add, edit and remove fields.
#. If you want to set a hidden field, make sure you set a valid default value
on it, or users may get hidden errors and they might even be unable to send
the form!

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/186/10.0

Known issues / Roadmap
======================

* These type of fields will not appear, they are forbidden since they make no
sense in this module's context, or a correct implementation would be adding
not much value while adding lots of complexity:

* ``id``
* ``create_uid``
* ``create_date``
* ``write_uid``
* ``write_date``
* ``__last_update``
* Any ``one2many`` fields
* Any ``reference`` fields
* Any ``serialized`` fields
* Any read-only fields

* You should include https://github.com/odoo/odoo/pull/21628 in your
installation to get a better UX when a user has already sent a form and
cannot resend it.

* To edit any ``<label>`` text, you need to click twice. Review the problem
once https://bugzilla.mozilla.org/show_bug.cgi?id=853519 gets fixed.

* You cannot edit base fields blacklisted status manually because
`Odoo forbids that for security
<https://github.com/OCA/website/pull/402#issuecomment-356930433>`_.

* ``website_form`` works in unexpected and undocumented ways. If you plan to
add support in your addon, `this is a good place to start reading
<https://github.com/OCA/website/pull/402#discussion_r157441770>`_.

* If you add a custom file upload field to a form that creates records in
models that have no ``mail.thread`` inheritance, your users will be unable
to send the form.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/website/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.

Credits
=======

Images
------

* https://openclipart.org/detail/281632/form
* https://openclipart.org/detail/224192/simple-grey-small-pencil-icon-white-background

Contributors
------------

* `Tecnativa <https://www.tecnativa.com>`_:
* Jairo Llopis <jairo.llopis@tecnativa.com>

Do not contact contributors directly about support or help with technical issues.

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
Empty file.
26 changes: 26 additions & 0 deletions website_form_builder/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Tecnativa - Jairo Llopis
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "Website Form Builder",
"summary": "Build customized forms in your website",
"version": "10.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/website",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": [
"website_form",
],
"data": [
"templates/assets.xml",
"templates/snippets.xml",
"views/ir_model.xml",
],
"demo": [
"demo/assets.xml",
"demo/ir_model.xml",
],
}
14 changes: 14 additions & 0 deletions website_form_builder/demo/assets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Tecnativa - Jairo Llopis
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->

<odoo>

<template id="demo_assets_editor" inherit_id="website.assets_editor">
<xpath expr=".">
<script type="text/javascript"
src="/website_form_builder/static/src/js/tour.js"/>
</xpath>
</template>

</odoo>
29 changes: 29 additions & 0 deletions website_form_builder/demo/ir_model.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Tecnativa - Jairo Llopis
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -->

<odoo>
<!-- Enable forms to create countries -->
<record id="base.model_res_country" model="ir.model">
<field name="website_form_access" eval="True"/>
<field name="website_form_label">Country</field>
</record>
<function model="ir.model.fields" name="formbuilder_whitelist">
<value>res.country</value>
<value eval="[
'name',
]"/>
</function>

<!-- Enable forms to create currencies -->
<record id="base.model_res_currency" model="ir.model">
<field name="website_form_access" eval="True"/>
<field name="website_form_label">Currency</field>
</record>
<function model="ir.model.fields" name="formbuilder_whitelist">
<value>res.currency</value>
<value eval="[
'name',
]"/>
</function>
</odoo>
164 changes: 164 additions & 0 deletions website_form_builder/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_form_builder
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-19 10:50+0000\n"
"PO-Revision-Date: 2018-01-19 10:52+0000\n"
"Last-Translator: Jairo Llopis <yajo.sk8@gmail.com>\n"
"Language-Team: \n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.0.3\n"

#. module: website_form_builder
#. openerp-web
#: code:addons/website_form_builder/static/src/js/snippets.js:317
#, python-format
msgid "%s help block"
msgstr "Bloque de ayuda para %s"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "<i class=\"fa fa-cogs\"/> Change action"
msgstr "<i class=\"fa fa-cogs\"/> Cambiar acción"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "<i class=\"fa fa-eye-slash\"/> Hide field"
msgstr "<i class=\"fa fa-eye-slash\"/> Esconder campo"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "<i class=\"fa fa-hand-spock-o\"/> Add custom field"
msgstr "<i class=\"fa fa-hand-spock-o\"/> Añadir campo personalizado"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "<i class=\"fa fa-plus\"/> Add model fields"
msgstr "<i class=\"fa fa-plus\"/> Añadir campo del modelo"

#. module: website_form_builder
#. openerp-web
#: code:addons/website_form_builder/static/src/js/widgets.js:106
#, python-format
msgid "Add Model Fields"
msgstr "Añadir campo del modelo"

#. module: website_form_builder
#. openerp-web
#: code:addons/website_form_builder/static/src/xml/widgets.xml:15
#, python-format
msgid "Choose the new field for the form"
msgstr "Escoja el nuevo campo para el formulario"

#. module: website_form_builder
#. openerp-web
#: code:addons/website_form_builder/static/src/xml/widgets.xml:30
#, python-format
msgid "Choose this form's action"
msgstr "Escoja la acción de este formulario"

#. module: website_form_builder
#. openerp-web
#: code:addons/website_form_builder/static/src/js/snippets.js:310
#, python-format
msgid "Custom %s field"
msgstr "Campo %s personalizado"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Date"
msgstr "Fecha"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Date and time"
msgstr "Fecha y hora"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Decimal number"
msgstr "Número decimal"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "File upload"
msgstr "Subida de archivos"

#. module: website_form_builder
#. openerp-web
#: code:addons/website_form_builder/static/src/js/widgets.js:75
#, python-format
msgid "Form Settings"
msgstr "Configuración del formulario"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Long text"
msgstr "Texto largo"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Multiple selection"
msgstr "Selección múltiple"

#. module: website_form_builder
#. openerp-web
#: code:addons/website_form_builder/static/src/js/snippets.js:313
#, python-format
msgid "Option %d"
msgstr "Opción %d"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.s_website_form
msgid "Send"
msgstr "Enviar"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Set as required"
msgstr "Hacer obligatorio"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Set default value"
msgstr "Establecer valor por defecto"

#. module: website_form_builder
#. openerp-web
#: code:addons/website_form_builder/static/src/js/widgets.js:35
#, python-format
msgid "Set field's default value"
msgstr "Establecer el valor por defecto para el campo"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Short text"
msgstr "Texto corto"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Single selection"
msgstr "Selección única"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.view_model_form
msgid "Website Forms"
msgstr "Formularios del sitio web"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Whole number"
msgstr "Número entero"

#. module: website_form_builder
#: model:ir.ui.view,arch_db:website_form_builder.snippet_options
msgid "Yes or not"
msgstr "Sí o no"
Binary file added website_form_builder/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 94c9f12

Please sign in to comment.