|
1 | 1 | # -*- coding: utf-8 -*-
|
2 |
| -# © 2015 Antiun Ingeniería S.L. - Antonio Espinosa |
| 2 | +# Copyright 2015 Antiun Ingeniería S.L. - Antonio Espinosa |
3 | 3 | # Copyright 2015-2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
4 | 4 | # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
5 | 5 |
|
@@ -127,17 +127,18 @@ def _inverse_name(self):
|
127 | 127 | s[s.field_n(num, True)] = self._get_field_id(
|
128 | 128 | model, field_name)
|
129 | 129 |
|
130 |
| - @api.one |
| 130 | + @api.multi |
131 | 131 | @api.constrains("field1_id", "field2_id", "field3_id")
|
132 | 132 | def _check_name(self):
|
133 |
| - if not self.label: |
134 |
| - raise exceptions.ValidationError( |
135 |
| - _("Field '%s' does not exist") % self.name) |
136 |
| - lines = self.search([('export_id', '=', self.export_id.id), |
137 |
| - ('name', '=', self.name)]) |
138 |
| - if len(lines) > 1: |
139 |
| - raise exceptions.ValidationError( |
140 |
| - _("Field '%s' already exists") % self.name) |
| 133 | + for rec_id in self: |
| 134 | + if not rec_id.label: |
| 135 | + raise exceptions.ValidationError( |
| 136 | + _("Field '%s' does not exist") % rec_id.name) |
| 137 | + lines = self.search([('export_id', '=', rec_id.export_id.id), |
| 138 | + ('name', '=', rec_id.name)]) |
| 139 | + if len(lines) > 1: |
| 140 | + raise exceptions.ValidationError( |
| 141 | + _("Field '%s' already exists") % rec_id.name) |
141 | 142 |
|
142 | 143 | @api.model
|
143 | 144 | def _install_base_export_manager(self):
|
|
0 commit comments