Browse Source

[REF] renaming fields and improve readme file

pull/1302/head
Sylvain LE GAL 8 years ago
parent
commit
b5fde44f4e
  1. 4
      mass_sorting/README.rst
  2. 4
      mass_sorting/i18n/fr.po
  3. 22
      mass_sorting/models/mass_sort_config.py
  4. 2
      mass_sorting/models/mass_sort_wizard.py
  5. 8
      mass_sorting/views/view_mass_sort_config.xml

4
mass_sorting/README.rst

@ -38,7 +38,9 @@ Usage
.. image:: /mass_sorting/static/description/4_before.png
* click on the button 'Action' and then select the according action
* click on the button 'Action' and then select the according action.
If you just created your action, please refresh the page
to see the new action appear.
.. image:: /mass_sorting/static/description/2_button.png

4
mass_sorting/i18n/fr.po

@ -189,12 +189,12 @@ msgid "Sequence"
msgstr "Séquence"
#. module: mass_sorting
#: model:ir.model.fields,field_description:mass_sorting.field_mass_sort_config_ref_ir_act_window
#: model:ir.model.fields,field_description:mass_sorting.field_mass_sort_config_action_id
msgid "Sidebar Action"
msgstr "Action"
#. module: mass_sorting
#: model:ir.model.fields,field_description:mass_sorting.field_mass_sort_config_ref_ir_value
#: model:ir.model.fields,field_description:mass_sorting.field_mass_sort_config_value_id
msgid "Sidebar Button"
msgstr "Bouton de la barre latérale"

22
mass_sorting/models/mass_sort_config.py

@ -31,13 +31,13 @@ class MassSortConfig(models.Model):
string='Model Name of the Field to Sort', hel="Technical field,"
"used in the model 'mass.sort.config.line'", store=True)
ref_ir_act_window = fields.Many2one(
action_id = fields.Many2one(
comodel_name='ir.actions.act_window', string='Sidebar Action',
readonly=True, copy=False)
readonly=True, copy=False, oldname='ref_ir_act_window')
ref_ir_value = fields.Many2one(
value_id = fields.Many2one(
comodel_name='ir.values', string='Sidebar Button', readonly=True,
copy=False)
copy=False, oldname='ref_ir_value')
line_ids = fields.One2many(
comodel_name='mass.sort.config.line', inverse_name='config_id',
@ -91,7 +91,7 @@ class MassSortConfig(models.Model):
values_obj = self.env['ir.values']
for config in self:
button_name = _('Mass Sort (%s)') % config.name
config.ref_ir_act_window = action_obj.create({
config.action_id = action_obj.create({
'name': button_name,
'type': 'ir.actions.act_window',
'res_model': 'mass.sort.wizard',
@ -101,18 +101,18 @@ class MassSortConfig(models.Model):
'view_mode': 'form,tree',
'target': 'new',
})
config.ref_ir_value = values_obj.create({
config.value_id = values_obj.create({
'name': button_name,
'model': config.model_id.model,
'key2': 'client_action_multi',
'value': (
"ir.actions.act_window,%s" % config.ref_ir_act_window.id),
"ir.actions.act_window,%s" % config.action_id.id),
})
@api.multi
def unlink_action(self):
for config in self:
if config.ref_ir_act_window:
config.ref_ir_act_window.unlink()
if config.ref_ir_value:
config.ref_ir_value.unlink()
if config.action_id:
config.action_id.unlink()
if config.value_id:
config.value_id.unlink()

2
mass_sorting/models/mass_sort_wizard.py

@ -56,7 +56,7 @@ class MassSortWizard(models.TransientModel):
". \n\nThe sorting will be done by %(field_list)s.") % ({
'field':
wizard.config_id.one2many_field_id.field_description,
'qty': len(self._context.get('active_ids', False)),
'qty': len(self._context.get('active_ids', [])),
'model': wizard.config_id.model_id.name,
'field_list': ', '.join(
[x.field_id.field_description

8
mass_sorting/views/view_mass_sort_config.xml

@ -32,10 +32,10 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<form>
<header>
<button name="create_action" string="Add sidebar button" type="object" class="btn btn-primary"
attrs="{'invisible':[('ref_ir_act_window','!=',False)]}"
attrs="{'invisible':[('action_id', '!=', False)]}"
help="Display a button in the sidebar of related model to open a wizard"/>
<button name="unlink_action" string="Remove sidebar button" type="object" class="btn btn-default"
attrs="{'invisible':[('ref_ir_act_window','=',False)]}"/>
attrs="{'invisible':[('action_id', '=', False)]}"/>
</header>
<sheet>
<div class="oe_title">
@ -45,8 +45,8 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<group col="4">
<field name="model_id"/>
<field name="one2many_field_id"/>
<field name="ref_ir_act_window" attrs="{'invisible':[('ref_ir_act_window','=',False)]}"/>
<field name="ref_ir_value" attrs="{'invisible':[('ref_ir_act_window','=',False)]}"/>
<field name="action_id" attrs="{'invisible':[('action_id', '=', False)]}"/>
<field name="value_id" attrs="{'invisible':[('action_id', '=', False)]}"/>
<field name="allow_custom_setting"/>
</group>

Loading…
Cancel
Save