forked from Yaltik/golem
[FIX]GOLEM SEASON : use update for onchange + unit test warning on membership creation
This commit is contained in:
parent
5143c1d985
commit
28407b4acf
@ -44,8 +44,10 @@ class GolemSeason(models.Model):
|
|||||||
for season in self:
|
for season in self:
|
||||||
if season.membership_id:
|
if season.membership_id:
|
||||||
if not season.date_start:
|
if not season.date_start:
|
||||||
season.date_start = season.membership_id.membership_date_from
|
season.update({
|
||||||
season.date_end = season.membership_id.membership_date_to
|
'date_start': season.membership_id.membership_date_from,
|
||||||
|
'date_end': season.membership_id.membership_date_to
|
||||||
|
})
|
||||||
|
|
||||||
@api.constrains('date_start', 'date_end')
|
@api.constrains('date_start', 'date_end')
|
||||||
def _check_period(self):
|
def _check_period(self):
|
||||||
|
@ -58,7 +58,7 @@ class TestGolemSeason(TransactionCase):
|
|||||||
def test__onchange_season_dates(self):
|
def test__onchange_season_dates(self):
|
||||||
""" Test if membership date """
|
""" Test if membership date """
|
||||||
membership = self.env['product.template'].create({'name': 'Name',
|
membership = self.env['product.template'].create({'name': 'Name',
|
||||||
'membership_id': 'truc',
|
'membership': True,
|
||||||
'membership_date_from': '2017-11-01',
|
'membership_date_from': '2017-11-01',
|
||||||
'membership_date_to': '2018-11-01'})
|
'membership_date_to': '2018-11-01'})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user