Commit e37fc766 authored by Sebastien Robin's avatar Sebastien Robin

allow to specify when we want to use the action to open counter date

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19450 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 25e134e3
...@@ -661,7 +661,8 @@ class TestERP5BankingMixin: ...@@ -661,7 +661,8 @@ class TestERP5BankingMixin:
if 'siege' not in site_list: if 'siege' not in site_list:
self.siege = self.site_base_category.newContent(id='siege', portal_type='Category', codification='HQ1', vault_type='site') self.siege = self.site_base_category.newContent(id='siege', portal_type='Category', codification='HQ1', vault_type='site')
def _openDate(self, date=None, site=None, id=None, open=True, container=None, portal_type=None): def _openDate(self, date=None, site=None, id=None, open=True, container=None,
portal_type=None, force_check=0):
if date is None: if date is None:
date = DateTime().Date() date = DateTime().Date()
if site is None: if site is None:
...@@ -669,7 +670,7 @@ class TestERP5BankingMixin: ...@@ -669,7 +670,7 @@ class TestERP5BankingMixin:
date_object = container.newContent(id=id, portal_type=portal_type, date_object = container.newContent(id=id, portal_type=portal_type,
site_value = site, start_date = date) site_value = site, start_date = date)
if open: if open:
if date_object.getPortalType() == 'Counter Date': if force_check and date_object.getPortalType() == 'Counter Date':
self.workflow_tool.doActionFor(date_object, 'open_action', self.workflow_tool.doActionFor(date_object, 'open_action',
wf_id='counter_date_workflow', wf_id='counter_date_workflow',
your_check_date_is_today=0) your_check_date_is_today=0)
...@@ -685,12 +686,15 @@ class TestERP5BankingMixin: ...@@ -685,12 +686,15 @@ class TestERP5BankingMixin:
""" """
self._openDate(date=date, site=site, id=id, open=open, container=self.getAccountingDateModule(), portal_type='Accounting Date') self._openDate(date=date, site=site, id=id, open=open, container=self.getAccountingDateModule(), portal_type='Accounting Date')
def openCounterDate(self, date=None, site=None, id='counter_date_1', open=True): def openCounterDate(self, date=None, site=None, id='counter_date_1', open=True, force_check=0):
""" """
open a couter date for the given date open a couter date for the given date
by default use the current date by default use the current date
""" """
self._openDate(date=date, site=site, id=id, open=open, container=self.getCounterDateModule(), portal_type='Counter Date') self._openDate(date=date, site=site, id=id, open=open,
container=self.getCounterDateModule(),
portal_type='Counter Date',
force_check=force_check)
def openCounter(self, site=None, id='counter_1'): def openCounter(self, site=None, id='counter_1'):
""" """
......
...@@ -103,7 +103,8 @@ class TestERP5BankingAvailableInventory(TestERP5BankingCheckPaymentMixin, ...@@ -103,7 +103,8 @@ class TestERP5BankingAvailableInventory(TestERP5BankingCheckPaymentMixin,
currency=self.currency_1, currency=self.currency_1,
line_list=self.line_list) line_list=self.line_list)
self.openCounter(site=self.money_deposit_counter.guichet_1,id='counter_2') self.openCounter(site=self.money_deposit_counter.guichet_1,id='counter_2',
force_check=1)
# Define foreign currency variables # Define foreign currency variables
inventory_dict_line_1 = {'id' : 'inventory_line_1', inventory_dict_line_1 = {'id' : 'inventory_line_1',
...@@ -259,21 +260,21 @@ class TestERP5BankingAvailableInventory(TestERP5BankingCheckPaymentMixin, ...@@ -259,21 +260,21 @@ class TestERP5BankingAvailableInventory(TestERP5BankingCheckPaymentMixin,
counter_date.close() counter_date.close()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
self.openCounterDate(site=self.paris, id='counter_date_3') self.openCounterDate(site=self.paris, id='counter_date_3', force_check=1)
counter_date = self.counter_date_3 counter_date = self.counter_date_3
self.assertEquals(counter_date.getReference(),'2') self.assertEquals(counter_date.getReference(),'2')
counter_date.close() counter_date.close()
counter_date.setStartDate(self.date-9) counter_date.setStartDate(self.date-9)
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
self.openCounterDate(site=self.paris, id='counter_date_4') self.openCounterDate(site=self.paris, id='counter_date_4', force_check=1)
counter_date = self.counter_date_4 counter_date = self.counter_date_4
self.assertEquals(counter_date.getReference(),'3') self.assertEquals(counter_date.getReference(),'3')
counter_date.close() counter_date.close()
counter_date.setStartDate(self.date-8) counter_date.setStartDate(self.date-8)
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
self.openCounterDate(site=self.paris, id='counter_date_5') self.openCounterDate(site=self.paris, id='counter_date_5', force_check=1)
counter_date = self.counter_date_5 counter_date = self.counter_date_5
self.assertEquals(counter_date.getReference(),'4') self.assertEquals(counter_date.getReference(),'4')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment