code refactoring
This commit is contained in:
parent
7223afa486
commit
b105d87745
@ -59,6 +59,7 @@ class GolemResourcePack(models.Model):
|
||||
@api.multi
|
||||
@api.constrains('partner_id')
|
||||
def set_reservation_partner(self):
|
||||
""" Set reservation partner """
|
||||
for pack in self:
|
||||
pack.reservation_ids.write({'partner_id': pack.partner_id.id})
|
||||
|
||||
@ -114,6 +115,7 @@ class GolemResourcePack(models.Model):
|
||||
@api.multi
|
||||
@api.constrains('reservation_ids')
|
||||
def check_reservation_partner(self):
|
||||
""" Check reservation partner """
|
||||
for pack in self:
|
||||
if len(filter(lambda x: x.partner_id == pack.partner_id, pack.reservation_ids)) < len(pack.reservation_ids):
|
||||
raise ValidationError(_('Pack client should be the same for all reservations'))
|
||||
|
@ -18,10 +18,7 @@
|
||||
|
||||
""" GOLEM Resource Reservation """
|
||||
|
||||
from math import modf
|
||||
from datetime import timedelta
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class GolemResourceReservation(models.Model):
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
import logging
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.exceptions import ValidationError
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user