[8.0][FIX][base_export_manager] Fix "Expected singleton" bug. (#521)
[FIX][base_export_manager] Fix "Expected singleton" bug.
If you had a field that got translated in more than 1 addon, you'd possibly getto this error:
File "/opt/odoo/0079_ahk_openerp/oca/base_export_manager/models/ir_exports_line.py", line 105, in _compute_label
field.name)),
File "/opt/odoo/common/openerp/v8/openerp/fields.py", line 825, in __get__
record.ensure_one()
File "/opt/odoo/common/openerp/v8/openerp/models.py", line 5355, in ensure_one
raise except_orm("ValueError", "Expected singleton: %s" % self)
except_orm: ('ValueError', 'Expected singleton: ir.translation(4899, 703976)')
With this patch, now we let Odoo return the translated string by using its
standard method to do so, so we have to care for less.
* Move installation outside a data file.
This makes the whole installation to be able to roll back if something goes
wrong, instead of entering an error loop.
* Include envorionment in its manager.
* Add 4th field
* Move to api.multi, refactoring some stuff.
- Add some comments in complex parts.
- Rename `onchange_name` to `_onchange_name` (guidelines).
- Make `_compute_name`'s try block shorter and easier to understand.
* Allow R/W of name directly in model.
* Update tests to cover new behaviors.
8 years ago [8.0][FIX][base_export_manager] Fix "Expected singleton" bug. (#521)
[FIX][base_export_manager] Fix "Expected singleton" bug.
If you had a field that got translated in more than 1 addon, you'd possibly getto this error:
File "/opt/odoo/0079_ahk_openerp/oca/base_export_manager/models/ir_exports_line.py", line 105, in _compute_label
field.name)),
File "/opt/odoo/common/openerp/v8/openerp/fields.py", line 825, in __get__
record.ensure_one()
File "/opt/odoo/common/openerp/v8/openerp/models.py", line 5355, in ensure_one
raise except_orm("ValueError", "Expected singleton: %s" % self)
except_orm: ('ValueError', 'Expected singleton: ir.translation(4899, 703976)')
With this patch, now we let Odoo return the translated string by using its
standard method to do so, so we have to care for less.
* Move installation outside a data file.
This makes the whole installation to be able to roll back if something goes
wrong, instead of entering an error loop.
* Include envorionment in its manager.
* Add 4th field
* Move to api.multi, refactoring some stuff.
- Add some comments in complex parts.
- Rename `onchange_name` to `_onchange_name` (guidelines).
- Make `_compute_name`'s try block shorter and easier to understand.
* Allow R/W of name directly in model.
* Update tests to cover new behaviors.
8 years ago [8.0][FIX][base_export_manager] Fix "Expected singleton" bug. (#521)
[FIX][base_export_manager] Fix "Expected singleton" bug.
If you had a field that got translated in more than 1 addon, you'd possibly getto this error:
File "/opt/odoo/0079_ahk_openerp/oca/base_export_manager/models/ir_exports_line.py", line 105, in _compute_label
field.name)),
File "/opt/odoo/common/openerp/v8/openerp/fields.py", line 825, in __get__
record.ensure_one()
File "/opt/odoo/common/openerp/v8/openerp/models.py", line 5355, in ensure_one
raise except_orm("ValueError", "Expected singleton: %s" % self)
except_orm: ('ValueError', 'Expected singleton: ir.translation(4899, 703976)')
With this patch, now we let Odoo return the translated string by using its
standard method to do so, so we have to care for less.
* Move installation outside a data file.
This makes the whole installation to be able to roll back if something goes
wrong, instead of entering an error loop.
* Include envorionment in its manager.
* Add 4th field
* Move to api.multi, refactoring some stuff.
- Add some comments in complex parts.
- Rename `onchange_name` to `_onchange_name` (guidelines).
- Make `_compute_name`'s try block shorter and easier to understand.
* Allow R/W of name directly in model.
* Update tests to cover new behaviors.
8 years ago [8.0][FIX][base_export_manager] Fix "Expected singleton" bug. (#521)
[FIX][base_export_manager] Fix "Expected singleton" bug.
If you had a field that got translated in more than 1 addon, you'd possibly getto this error:
File "/opt/odoo/0079_ahk_openerp/oca/base_export_manager/models/ir_exports_line.py", line 105, in _compute_label
field.name)),
File "/opt/odoo/common/openerp/v8/openerp/fields.py", line 825, in __get__
record.ensure_one()
File "/opt/odoo/common/openerp/v8/openerp/models.py", line 5355, in ensure_one
raise except_orm("ValueError", "Expected singleton: %s" % self)
except_orm: ('ValueError', 'Expected singleton: ir.translation(4899, 703976)')
With this patch, now we let Odoo return the translated string by using its
standard method to do so, so we have to care for less.
* Move installation outside a data file.
This makes the whole installation to be able to roll back if something goes
wrong, instead of entering an error loop.
* Include envorionment in its manager.
* Add 4th field
* Move to api.multi, refactoring some stuff.
- Add some comments in complex parts.
- Rename `onchange_name` to `_onchange_name` (guidelines).
- Make `_compute_name`'s try block shorter and easier to understand.
* Allow R/W of name directly in model.
* Update tests to cover new behaviors.
8 years ago |
|
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="ir_exports_action" model="ir.actions.act_window"> <field name="name">Export Profiles</field> <field name="res_model">ir.exports</field> <field name="view_type">form</field> <field name="view_mode">tree,form</field> </record>
<menuitem id="ir_exports_menu" parent="base.next_id_2" name="Export Profiles" action="ir_exports_action"/>
<record id="ir_exports_tree_view" model="ir.ui.view"> <field name="name">Export Profile tree</field> <field name="model">ir.exports</field> <field name="arch" type="xml"> <tree string="Export Profiles"> <field name="name"/> <field name="model_id"/> <field name="resource"/> </tree> </field> </record>
<record id="ir_exports_form_view" model="ir.ui.view"> <field name="name">Export Profile form</field> <field name="model">ir.exports</field> <field name="arch" type="xml"> <form string="Export Profile"> <group> <field name="name"/> <field name="model_id" options="{'no_create': True}"/> <field name="resource"/> </group> <group> <field name="export_fields" nolabel="1" context="{'default_model1_id': model_id}"> <tree editable="bottom"> <field name="sequence" widget="handle"/> <field name="model1_id" invisible="True"/> <field name="model2_id" invisible="True"/> <field name="model3_id" invisible="True"/> <field name="model4_id" invisible="True"/> <field name="label"/> <field name="name"/> <field name="field1_id" required="True" options="{'no_open': True, 'no_create': True}"/> <field name="field2_id" attrs="{'readonly': [('model2_id', '=', False)]}" options="{'no_open': True, 'no_create': True}"/> <field name="field3_id" attrs="{'readonly': [('model3_id', '=', False)]}" options="{'no_open': True, 'no_create': True}"/> <field name="field4_id" attrs="{'readonly': [('model3_id', '=', False)]}" options="{'no_open': True, 'no_create': True}"/> </tree> </field> </group> </form> </field> </record>
</odoo>
|