Skip to content

Commit

Permalink
[IMP] formio: Several improvements
Browse files Browse the repository at this point in the history
- Builder: formio.js version (field) domain/filter exclude Dummy.
- Builder: hide the Assigned user (`user_id`) field.
  Let's see if this still needed, otherwise change to `Many2many2`.
- Remove menu to `formio.res.model`
  Issue: #190: (#190)

Closes #190
  • Loading branch information
bobslee committed Jun 21, 2022
1 parent 23ca086 commit 2ffc6e8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
8 changes: 8 additions & 0 deletions formio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

### 9.23

- Builder: formio.js version (field) domain/filter exclude Dummy.
- Builder: hide the Assigned user (`user_id`) field.\
Let's see if this still needed, otherwise change to `Many2many2`.
- Remove menu to `formio.res.model`\
Issue: [\#190](https://github.com/novacode-nl/odoo-formio/issues/190)

### 9.22

- Remove `formio.version` and related assets data
Expand Down
2 changes: 1 addition & 1 deletion formio/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
'name': 'Forms',
'summary': 'Form Builder & integration of professional and versatile Forms to collect any information you need for your business.',
'version': '9.22',
'version': '9.23',
'license': 'LGPL-3',
'author': 'Nova Code',
'website': 'https://www.novacode.nl',
Expand Down
3 changes: 2 additions & 1 deletion formio/models/formio_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Builder(models.Model):
description = fields.Text("Description")
formio_version_id = fields.Many2one(
'formio.version', string='formio.js version', required=True,
domain="[('is_dummy', '=', False)]",
default=lambda self: self._default_formio_version_id(), tracking=True,
help="""Loads the specific formio.js Javascript libraries version (sourcecode: https://github.com/formio/formio.js)""")
formio_version_name = fields.Char(related='formio_version_id.name', string='formio.js version name', tracking=False) # silly, but avoids duplicate tracking message
Expand Down Expand Up @@ -85,7 +86,7 @@ class Builder(models.Model):
parent_version = fields.Integer(related='parent_id.version', string='Parent Version', readonly=True)
version = fields.Integer("Version", required=True, readonly=True, default=1)
version_comment = fields.Text("Version Comment")
user_id = fields.Many2one('res.users', string='Assigned user', tracking=True)
user_id = fields.Many2one('res.users', string='Assigned user', tracking=True) # TODO old field, remove?
forms = fields.One2many('formio.form', 'builder_id', string='Forms')
portal = fields.Boolean("Portal", tracking=True, help="Form is accessible by assigned portal user")
portal_submit_done_url = fields.Char(
Expand Down
2 changes: 1 addition & 1 deletion formio/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

formio_default_version_id = fields.Many2one('formio.version', string='formio.js version')
formio_default_version_id = fields.Many2one('formio.version', string='formio.js version', domain="[('is_dummy', '=', False)]")
formio_default_asset_css_ids = fields.Many2many('formio.default.asset.css', string='formio.js CSS assets', context={'active_test': False})
formio_default_builder_js_options_id = fields.Many2one('formio.builder.js.options', string='formio.js builder options ID')
formio_default_builder_js_options = fields.Text(related='formio_default_builder_js_options_id.value', string='formio.js builder options')
Expand Down
7 changes: 0 additions & 7 deletions formio/views/formio_builder_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ See LICENSE file for full licensing details. -->
<field name="public" optional="show"/>
<field name="public_url" optional="hide"/>
<field name="formio_version_id"/>
<field name="user_id" optional="hide"/>
<field name="parent_id" optional="hide"/>
<field name="write_date" optional="hide"/>
<field name="create_date" optional="hide"/>
Expand Down Expand Up @@ -102,7 +101,6 @@ See LICENSE file for full licensing details. -->
<group>
<field name="uuid" attrs="{'invisible': [('id', '=', False)]}"/>
<field name="is_locked" attrs="{'invisible': [('state', '!=', 'CURRENT')]}"/>
<field name="user_id"/>
</group>
</group>
<notebook>
Expand Down Expand Up @@ -296,12 +294,8 @@ See LICENSE file for full licensing details. -->
<search string="Form Builders">
<field name="title"/>
<field name="name"/>
<field name="user_id"/>
<field name="formio_version_id"/>
<separator/>
<filter string="My Form Builders" name="my_builders"
domain="[('user_id', '=', uid)]"/>
<separator/>
<filter string="Draft" name="state_draft"
domain="[('state', '=', 'DRAFT')]"/>
<filter string="Current" name="state_current"
Expand All @@ -320,7 +314,6 @@ See LICENSE file for full licensing details. -->
domain="[('wizard', '=', False)]"/>
<group expand="0" string="Group By">
<filter string="Name" name="name" domain="[]" context="{'group_by':'name'}"/>
<filter string="Assigned User" name="user" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="State" name="state" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
Expand Down
12 changes: 6 additions & 6 deletions formio/views/formio_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ See LICENSE file for full licensing details. -->
parent="formio.menu_formio_configuration"
sequence="100"
action="formio.action_formio_builder_js_options"/>
<menuitem
id="menu_formio_res_model"
name="Resource Models"
parent="formio.menu_formio_configuration"
sequence="200"
action="formio.action_formio_res_model"/>
<!-- <menuitem -->
<!-- id="menu_formio_res_model" -->
<!-- name="Resource Models" -->
<!-- parent="formio.menu_formio_configuration" -->
<!-- sequence="200" -->
<!-- action="formio.action_formio_res_model"/> -->

</odoo>

0 comments on commit 2ffc6e8

Please sign in to comment.