[IMP] rma_operating_unit: black, isort, prettier

This commit is contained in:
Juany Davila
2023-03-20 15:19:57 -05:00
committed by Aaron ForgeFlow
parent 216b4ae897
commit cddc0324cf
10 changed files with 204 additions and 133 deletions

View File

@@ -1,7 +1,7 @@
# © 2017-19 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models, _
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
@@ -10,15 +10,19 @@ class RmaOrder(models.Model):
_inherit = "rma.order"
@api.multi
@api.constrains('rma_line_ids', 'rma_line_ids.operating_unit_id')
@api.constrains("rma_line_ids", "rma_line_ids.operating_unit_id")
def _check_operating_unit(self):
for rma in self:
bad_lines = rma.rma_line_ids.filtered(
lambda l: l.operating_unit_id != rma.operating_unit_id)
lambda l: l.operating_unit_id != rma.operating_unit_id
)
if bad_lines:
raise ValidationError(
_('The operating unit of the rma lines have to match the'
' one of the group'))
_(
"The operating unit of the rma lines have to match the"
" one of the group"
)
)
return True
@api.model
@@ -26,7 +30,7 @@ class RmaOrder(models.Model):
return self.env.user.default_operating_unit_id
operating_unit_id = fields.Many2one(
comodel_name='operating.unit',
string='Operating Unit',
comodel_name="operating.unit",
string="Operating Unit",
default=_default_operating_unit,
)