[IMP] Test_pms_sale_channel

This commit is contained in:
Sara Lago
2020-11-11 10:03:50 +01:00
committed by Darío Lodeiros
parent c3c5ff059c
commit ca2874bb3f
5 changed files with 52 additions and 45 deletions

View File

@@ -22,3 +22,4 @@
from . import test_pms_reservation
from . import test_pms_pricelist
from . import test_pms_checkin_partner
from . import test_pms_sale_channel

View File

@@ -0,0 +1,32 @@
from .common import TestHotel
from freezegun import freeze_time
from odoo.exceptions import ValidationError
import datetime
from odoo import fields
@freeze_time("2010-01-01")
class TestPmsSaleChannel(TestHotel):
def test_reservation_indirect_channel(self):
#ARRANGE
PmsReservation = self.env["pms.reservation"]
not_agency = self.env["res.partner"].create(
{
"name":"partner1",
"is_agency":False
}
)
#ACT & ASSERT
with self.assertRaises(ValidationError), self.cr.savepoint():
PmsReservation.create(
{
"checkin": datetime.datetime.now(),
"checkout":datetime.datetime.now() + datetime.timedelta(days=3),
"channel_type":"indirect",
"partner_id":not_agency.id
}
)