Commit b3aaf64e authored by Jérome Perrin's avatar Jérome Perrin

*: run 2to3 numliterals fixers

a modified version from nexedi/erp5$366
that supports patterns like
DateTime(2001, 02, 03) => DateTime(2001, 2, 3)
and not DateTime(2001, 0o2, 0o3)
parent 0048d09c
......@@ -5,7 +5,7 @@ from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
portal = context.getPortalObject()
accounting_module = portal.accounting_module
year = 2005
default_date = DateTime(year, 01, 01)
default_date = DateTime(year, 1, 1)
business_process = portal.portal_catalog.getResultValue(
reference=('default_erp5_business_process', # erp5_configurator
......
......@@ -98,8 +98,8 @@ for month in range(1, month_count + 1):
source_payment=getBankAccountByTitle('My default bank account'),
destination_section=getOrganisationByTitle(client_title),
created_by_builder=1,
start_date=DateTime(year, month, day, 01, 01) + 10,
stop_date=DateTime(year, month, day, 01, 01) + 10,
start_date=DateTime(year, month, day, 1, 1) + 10,
stop_date=DateTime(year, month, day, 1, 1) + 10,
causality_value=tr,
resource=euro_resource,
)
......
......@@ -208,7 +208,7 @@ class CertificateAuthorityTool(BaseTool):
cert = os.path.join(self.certificate_authority_path, 'certs',
new_id + '.crt')
try:
os.close(os.open(key, os.O_CREAT | os.O_EXCL, 0600))
os.close(os.open(key, os.O_CREAT | os.O_EXCL, 0o600))
popenCommunicate([self.openssl_binary, 'req', '-utf8', '-nodes', '-config',
self.openssl_config, '-new', '-keyout', key, '-out', csr, '-days',
'3650'], '%s\n' % common_name, stdin=subprocess.PIPE)
......
......@@ -822,7 +822,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
group='my_group')
accounting_period = organisation.newContent(
portal_type='Accounting Period',
start_date=DateTime(2001, 01, 01),
start_date=DateTime(2001, 1, 1),
stop_date=DateTime(2002, 12, 31))
self.assertEqual(accounting_period.getSimulationState(), 'draft')
......@@ -1054,8 +1054,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
def stepAccountingTransaction(self, sequence=None, sequence_list=None, **kw):
transaction = self.portal.accounting_module.newContent(
portal_type='Accounting Transaction',
start_date=DateTime(2001, 01, 01),
stop_date=DateTime(2001, 01, 01))
start_date=DateTime(2001, 1, 1),
stop_date=DateTime(2001, 1, 1))
self.assertEqual('draft', transaction.getSimulationState())
for user_id in self._getUserIdList(self.all_username_list):
self.assertUserCanViewDocument(user_id, transaction)
......@@ -1186,8 +1186,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
def stepSaleInvoiceTransaction(self, sequence=None, sequence_list=None, **kw):
transaction = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction',
start_date=DateTime(2001, 01, 01),
stop_date=DateTime(2001, 01, 01))
start_date=DateTime(2001, 1, 1),
stop_date=DateTime(2001, 1, 1))
self.assertEqual('draft', transaction.getSimulationState())
for user_id in self._getUserIdList(self.all_username_list):
self.assertUserCanViewDocument(user_id, transaction)
......@@ -1329,8 +1329,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
def stepPurchaseInvoiceTransaction(self, sequence=None, sequence_list=None, **kw):
transaction = self.portal.accounting_module.newContent(
portal_type='Purchase Invoice Transaction',
start_date=DateTime(2001, 01, 01),
stop_date=DateTime(2001, 01, 01))
start_date=DateTime(2001, 1, 1),
stop_date=DateTime(2001, 1, 1))
self.assertEqual('draft', transaction.getSimulationState())
for user_id in self._getUserIdList(self.all_username_list):
self.assertUserCanViewDocument(user_id, transaction)
......@@ -1476,8 +1476,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
def stepPaymentTransaction(self, sequence=None, sequence_list=None, **kw):
transaction = self.portal.accounting_module.newContent(
portal_type='Payment Transaction',
start_date=DateTime(2001, 01, 01),
stop_date=DateTime(2001, 01, 01))
start_date=DateTime(2001, 1, 1),
stop_date=DateTime(2001, 1, 1))
self.assertEqual('draft', transaction.getSimulationState())
for user_id in self._getUserIdList(self.all_username_list):
self.assertUserCanViewDocument(user_id, transaction)
......@@ -1621,29 +1621,29 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
accounting_transaction_x_related_to_a = self.portal.\
accounting_module.newContent(
portal_type='Accounting Transaction',
start_date=DateTime(2010, 06, 01),
stop_date=DateTime(2010, 06, 01))
start_date=DateTime(2010, 6, 1),
stop_date=DateTime(2010, 6, 1))
accounting_transaction_y_related_to_a = self.portal.\
accounting_module.newContent(
portal_type='Accounting Transaction',
start_date=DateTime(2010, 06, 01),
stop_date=DateTime(2010, 06, 01))
start_date=DateTime(2010, 6, 1),
stop_date=DateTime(2010, 6, 1))
accounting_transaction_a = self.portal.accounting_module.newContent(
portal_type='Accounting Transaction',
start_date=DateTime(2010, 06, 01),
stop_date=DateTime(2010, 06, 01))
start_date=DateTime(2010, 6, 1),
stop_date=DateTime(2010, 6, 1))
accounting_transaction_b = self.portal.accounting_module.newContent(
portal_type='Accounting Transaction',
start_date=DateTime(2010, 06, 01),
stop_date=DateTime(2010, 06, 01))
start_date=DateTime(2010, 6, 1),
stop_date=DateTime(2010, 6, 1))
accounting_transaction_c = self.portal.accounting_module.newContent(
portal_type='Accounting Transaction',
start_date=DateTime(2010, 06, 01),
stop_date=DateTime(2010, 06, 01))
start_date=DateTime(2010, 6, 1),
stop_date=DateTime(2010, 6, 1))
accounting_transaction_x_related_to_a.setCausalityValue(\
accounting_transaction_a)
......
......@@ -138,7 +138,7 @@ class TestAlarm(ERP5TypeTestCase):
right_first_date = DateTime(self.date_format % (2006,10,6,15,00,00))
now = DateTime(self.date_format % (2006,10,6,15,00,00))
right_second_date = DateTime(self.date_format % (2006,10,6,21,00,00))
right_third_date = DateTime(self.date_format % (2006,10,7,06,00,00))
right_third_date = DateTime(self.date_format % (2006,10,7,6,00,00))
right_fourth_date = DateTime(self.date_format % (2006,10,7,10,00,00))
alarm = self.newAlarm(enabled=True)
hour_list = (6,10,15,21)
......@@ -234,8 +234,8 @@ class TestAlarm(ERP5TypeTestCase):
def test_09_SomeMonthDaysSomeHours(self):
"""- every 1st and 15th every month, at 12 and 14"""
right_first_date = DateTime(self.date_format % (2006,10,01,12,00,00))
right_second_date = DateTime(self.date_format % (2006,10,01,14,00,00))
right_first_date = DateTime(self.date_format % (2006,10,1,12,00,00))
right_second_date = DateTime(self.date_format % (2006,10,1,14,00,00))
right_third_date = DateTime(self.date_format % (2006,10,15,12,00,00))
right_fourth_date = DateTime(self.date_format % (2006,10,15,14,00,00))
alarm = self.newAlarm(enabled=True)
......@@ -247,9 +247,9 @@ class TestAlarm(ERP5TypeTestCase):
def test_10_OnceEvery2Month(self):
"""- every 1st day of every 2 month, at 6"""
right_first_date = DateTime(self.date_format % (2006,10,01,6,00,00))
right_second_date = DateTime(self.date_format % (2006,12,01,6,00,00))
right_third_date = DateTime(self.date_format % (2007,2,01,6,00,00))
right_first_date = DateTime(self.date_format % (2006,10,1,6,00,00))
right_second_date = DateTime(self.date_format % (2006,12,1,6,00,00))
right_third_date = DateTime(self.date_format % (2007,2,1,6,00,00))
alarm = self.newAlarm(enabled=True)
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityMonthDayList((1,))
......
......@@ -799,7 +799,7 @@ class TestERP5Base(ERP5TypeTestCase):
"""Tests dates on Person objects.
"""
pers = self.getPersonModule().newContent(portal_type='Person')
birthday = DateTime(1999, 01, 01)
birthday = DateTime(1999, 1, 1)
now = DateTime()
pers.edit(birthday = birthday)
self.assertEqual(birthday, pers.getBirthday())
......@@ -814,7 +814,7 @@ class TestERP5Base(ERP5TypeTestCase):
"""Tests dates on Organisation objects.
"""
org = self.getOrganisationModule().newContent(portal_type='Organisation')
start_date = DateTime(1999, 01, 01)
start_date = DateTime(1999, 1, 1)
now = DateTime()
org.edit(start_date = start_date)
self.assertEqual(start_date, org.getStartDate())
......@@ -964,7 +964,7 @@ class TestERP5Base(ERP5TypeTestCase):
subordination_value=first_organisation,
start_date=DateTime(1996, 9, 9))
another_cancelled_career.cancel()
self.assertEqual(DateTime(2001, 01, 01),
self.assertEqual(DateTime(2001, 1, 1),
person.Person_getCareerStartDate(
subordination_relative_url=first_organisation.getRelativeUrl()))
......
......@@ -384,7 +384,7 @@ class TestDateTimeField(ERP5TypeTestCase):
.xpath('%s/text()' % ODG_XML_WRAPPING_XPATH, namespaces=NSMAP)[0])
def test_render_odt_variable(self):
value = DateTime(2010, 12, 06, 10, 23, 32, 'GMT+5')
value = DateTime(2010, 12, 6, 10, 23, 32, 'GMT+5')
self.field.values['default'] = value
node = self.field.render_odt_variable(as_string=False)
self.assertEqual(node.get('{%s}value-type' % NSMAP['office']), 'date')
......
......@@ -280,7 +280,7 @@ class TestPreferences(PropertySheetTestCase):
portal_workflow.doActionFor(
person1, 'enable_action', wf_id='preference_workflow')
self.assertEqual(person1.getPreferenceState(), 'enabled')
person1.setPreferredAccountingTransactionAtDate(DateTime(2005, 01, 01))
person1.setPreferredAccountingTransactionAtDate(DateTime(2005, 1, 1))
pref_tool.setPreference(
'preferred_accounting_transaction_at_date', DateTime(2004, 12, 31))
self.tic()
......@@ -320,7 +320,7 @@ class TestPreferences(PropertySheetTestCase):
# create a pref for user_b
user_b_1 = portal_preferences.newContent(
id='user_b_1', portal_type='Preference')
user_b_1.setPreferredAccountingTransactionAtDate(DateTime(2002, 02, 02))
user_b_1.setPreferredAccountingTransactionAtDate(DateTime(2002, 2, 2))
self.tic()
# enable this preference
......
......@@ -313,7 +313,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
employee = sequence.get('employee')
model.edit(destination_section_value=employer,
source_section_value=employee,
effective_date=DateTime(2009,01,01),
effective_date=DateTime(2009,1,1),
expiration_date=DateTime(2009,12,31),
version='001',
reference='basic_model',
......@@ -552,8 +552,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
source_section_value=sequence.get('employee'),
destination_section_value=sequence.get('employer'),
resource_value=sequence.get('price_currency'),
start_date=DateTime(2009,06,01),
stop_date=DateTime(2009,06,30))
start_date=DateTime(2009,6,1),
stop_date=DateTime(2009,6,30))
sequence.edit(paysheet = paysheet)
def createPaysheetLine(self, document, **kw):
......@@ -1021,7 +1021,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
model.edit(\
price_currency_value=currency,
default_payment_condition_trade_date='custom',
default_payment_condition_payment_date=DateTime(2009,05,25),
default_payment_condition_payment_date=DateTime(2009,5,25),
work_time_annotation_line_quantity=151.67,
work_time_annotation_line_quantity_unit='time/hours',
)
......@@ -1042,7 +1042,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
self.assertEqual(paysheet.getPriceCurrencyValue(), currency)
self.assertEqual(paysheet.getDefaultPaymentConditionTradeDate(), 'custom')
self.assertEqual(paysheet.getDefaultPaymentConditionPaymentDate(),
DateTime(2009,05,25))
DateTime(2009,5,25))
self.assertEqual(paysheet.getWorkTimeAnnotationLineQuantity(), 151.67)
self.assertEqual(paysheet.getWorkTimeAnnotationLineQuantityUnit(),
'time/hours')
......@@ -1633,7 +1633,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
variation_settings_category_list=['salary_range/france',],
reference='fabien_model_2009',
effective_date=DateTime(2009, 1, 1),
expiration_date=DateTime(2009, 06, 30))
expiration_date=DateTime(2009, 6, 30))
model_1.validate()
model_2 = self.getPortalObject().paysheet_model_module.newContent( \
......@@ -1641,7 +1641,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
variation_settings_category_list=['salary_range/france',],
reference='fabien_model_2009',
effective_date=DateTime(2009, 07, 1),
effective_date=DateTime(2009, 7, 1),
expiration_date=DateTime(2009, 12, 31))
model_2.validate()
......@@ -1672,8 +1672,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
paysheet = self.portal.accounting_module.newContent(
portal_type='Pay Sheet Transaction',
specialise_value=model_1,
start_date=DateTime(2009, 07, 1),
stop_date=DateTime(2009, 07, 31),
start_date=DateTime(2009, 7, 1),
stop_date=DateTime(2009, 7, 31),
price_currency_value=eur)
paysheet.PaySheetTransaction_applyModel()
self.tic()
......@@ -1701,8 +1701,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
variation_settings_category_list=['salary_range/france',],
reference='fabien_model_2009',
effective_date=DateTime(2009, 01, 1),
expiration_date=DateTime(2009, 02, 28),
effective_date=DateTime(2009, 1, 1),
expiration_date=DateTime(2009, 2, 28),
specialise_value=sequence.get('business_process'))
model_1.validate()
......@@ -1712,7 +1712,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
variation_settings_category_list=['salary_range/france',],
reference='fabien_model_2009',
effective_date=DateTime(2009, 07, 1),
effective_date=DateTime(2009, 7, 1),
expiration_date=DateTime(2009, 12, 31),
version='002',
specialise_value=sequence.get('business_process'))
......@@ -1722,7 +1722,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
variation_settings_category_list=['salary_range/france',],
reference='fabien_model_2009',
effective_date=DateTime(2009, 07, 1),
effective_date=DateTime(2009, 7, 1),
expiration_date=DateTime(2009, 12, 31),
version='001',
specialise_value=sequence.get('business_process'))
......@@ -1733,8 +1733,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
paysheet = self.portal.accounting_module.newContent(
portal_type='Pay Sheet Transaction',
specialise_value=model_1,
start_date=DateTime(2009, 07, 1),
stop_date=DateTime(2009, 07, 31),
start_date=DateTime(2009, 7, 1),
stop_date=DateTime(2009, 7, 31),
price_currency_value=eur)
paysheet.PaySheetTransaction_applyModel()
self.tic()
......@@ -1796,8 +1796,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
specialise_value=sequence.get('business_process'),
reference='fabien_model_2009',
effective_date=DateTime(2009, 01, 1),
expiration_date=DateTime(2009, 02, 28))
effective_date=DateTime(2009, 1, 1),
expiration_date=DateTime(2009, 2, 28))
model_line_1 = self.createModelLine(model_1)
model_line_1.edit(
resource_value=labour,
......@@ -1812,7 +1812,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
specialise_value=sequence.get('business_process'),
reference='fabien_model_2009',
effective_date=DateTime(2009, 07, 1),
effective_date=DateTime(2009, 7, 1),
expiration_date=DateTime(2009, 12, 31),
version='002')
model_line_2 = self.createModelLine(model_2)
......@@ -1827,7 +1827,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
specialise_value=sequence.get('business_process'),
reference='fabien_model_2009',
effective_date=DateTime(2009, 07, 1),
effective_date=DateTime(2009, 7, 1),
expiration_date=DateTime(2009, 12, 31),
version='001')
model_line_3 = self.createModelLine(model_3)
......@@ -1844,8 +1844,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
specialise_value=sequence.get('business_process'),
reference='fabien_model_level_2_2009',
effective_date=DateTime(2009, 01, 1),
expiration_date=DateTime(2009, 06, 30),
effective_date=DateTime(2009, 1, 1),
expiration_date=DateTime(2009, 6, 30),
version='002')
model_line_4 = self.createModelLine(model_4)
model_line_4.edit(
......@@ -1859,7 +1859,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
specialise_value=sequence.get('business_process'),
reference='fabien_model_level_2_2009',
effective_date=DateTime(2009, 07, 1),
effective_date=DateTime(2009, 7, 1),
expiration_date=DateTime(2009, 12, 31),
version='001')
model_line_5 = self.createModelLine(model_5)
......@@ -1876,8 +1876,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
specialise_value=sequence.get('business_process'),
reference='fabien_model_level_3_2009',
effective_date=DateTime(2009, 01, 1),
expiration_date=DateTime(2009, 06, 30),
effective_date=DateTime(2009, 1, 1),
expiration_date=DateTime(2009, 6, 30),
version='002')
model_line_6 = self.createModelLine(model_6)
model_line_6.edit(
......@@ -1891,7 +1891,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
specialise_value=sequence.get('business_process'),
reference='fabien_model_level_3_2009',
effective_date=DateTime(2009, 07, 1),
effective_date=DateTime(2009, 7, 1),
expiration_date=DateTime(2009, 12, 31),
version='001')
model_line_7 = self.createModelLine(model_7)
......@@ -1907,7 +1907,7 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
portal_type='Pay Sheet Model',
specialise_value=sequence.get('business_process'),
reference='fabien_model_level_3_2009',
effective_date=DateTime(2009, 07, 1),
effective_date=DateTime(2009, 7, 1),
expiration_date=DateTime(2009, 12, 31),
version='001')
......@@ -1917,8 +1917,8 @@ class TestPayrollMixin(TestTradeModelLineMixin, ERP5ReportTestCase):
paysheet = self.portal.accounting_module.newContent(
portal_type='Pay Sheet Transaction',
specialise_value=model_1,
start_date=DateTime(2009, 07, 1),
stop_date=DateTime(2009, 07, 31),
start_date=DateTime(2009, 7, 1),
stop_date=DateTime(2009, 7, 31),
price_currency_value=eur)
specialise_value = paysheet.getSpecialiseValue()
......
......@@ -46,7 +46,7 @@ class TestDSNSocialDeclarationReport(ERP5TypeTestCase):
"""
self.dsn_module = self.portal.getDefaultModuleValue("DSN Monthly Report")
self.setTimeZoneToUTC()
self.pinDateTime(DateTime(2015, 12, 01))
self.pinDateTime(DateTime(2015, 12, 1))
# Create the id_group 'dsn_event_counter'
self.portal.portal_ids.generateNewId(id_group='dsn_event_counter', id_generator='continuous_integer_increasing')
......
......@@ -281,16 +281,16 @@ class TestInvoice(TestInvoiceMixin):
self.assertEqual(other_resource,
invoice_movement.getResourceValue())
order_line.setStartDate(DateTime(2001, 02, 03))
order_line.setStartDate(DateTime(2001, 2, 3))
self.tic()
invoice_movement = invoice_applied_rule.contentValues()[0]
self.assertEqual(DateTime(2001, 02, 03),
self.assertEqual(DateTime(2001, 2, 3),
invoice_movement.getStartDate())
order_line.setStopDate(DateTime(2002, 03, 04))
order_line.setStopDate(DateTime(2002, 3, 4))
self.tic()
invoice_movement = invoice_applied_rule.contentValues()[0]
self.assertEqual(DateTime(2002, 03, 04),
self.assertEqual(DateTime(2002, 3, 4),
invoice_movement.getStopDate())
@newSimulationExpectedFailure
......@@ -478,20 +478,20 @@ class TestInvoice(TestInvoiceMixin):
self.assertEqual(456,
invoice_transaction_movement.getQuantity())
order_line.setStartDate(DateTime(2001, 02, 03))
order_line.setStartDate(DateTime(2001, 2, 3))
self.tic()
self.assertEqual(3, len(invoice_transaction_applied_rule))
invoice_transaction_movement = getIncomeSimulationMovement(
invoice_transaction_applied_rule)
self.assertEqual(DateTime(2001, 02, 03),
self.assertEqual(DateTime(2001, 2, 3),
invoice_transaction_movement.getStartDate())
order_line.setStopDate(DateTime(2002, 03, 04))
order_line.setStopDate(DateTime(2002, 3, 4))
self.tic()
self.assertEqual(3, len(invoice_transaction_applied_rule))
invoice_transaction_movement = getIncomeSimulationMovement(
invoice_transaction_applied_rule)
self.assertEqual(DateTime(2002, 03, 04),
self.assertEqual(DateTime(2002, 3, 4),
invoice_transaction_movement.getStopDate())
def test_Invoice_viewAsODT(self):
......
......@@ -162,10 +162,10 @@ class TestApplyTradeCondition(TradeConditionTestCase):
def test_apply_trade_condition_with_payment_conditions(self):
self.trade_condition.setPaymentConditionTradeDate('custom')
self.trade_condition.setPaymentConditionPaymentDate(DateTime(2001, 01, 01))
self.trade_condition.setPaymentConditionPaymentDate(DateTime(2001, 1, 1))
self.order.setSpecialiseValue(self.trade_condition)
self.assertEqual('custom', self.order.asComposedDocument().getProperty('payment_condition_trade_date'))
self.assertEqual(DateTime(2001, 01, 01),
self.assertEqual(DateTime(2001, 1, 1),
self.order.asComposedDocument().getProperty('payment_condition_payment_date'))
def test_apply_trade_condition_with_payment_conditions_with_hierarchy(self):
......@@ -174,12 +174,12 @@ class TestApplyTradeCondition(TradeConditionTestCase):
title='Other Trade Condition')
other_trade_condition.setPaymentConditionTradeDate('custom')
other_trade_condition.setPaymentConditionPaymentDate(
DateTime(2001, 01, 01))
DateTime(2001, 1, 1))
self.trade_condition.setSpecialiseValue(other_trade_condition)
self.order.setSpecialiseValue(self.trade_condition)
self.assertEqual('custom', self.order.asComposedDocument().getProperty('payment_condition_trade_date'))
self.assertEqual(DateTime(2001, 01, 01),
self.assertEqual(DateTime(2001, 1, 1),
self.order.asComposedDocument().getProperty('payment_condition_payment_date'))
def test_apply_trade_condition_twice_update_order(self):
......@@ -189,7 +189,7 @@ class TestApplyTradeCondition(TradeConditionTestCase):
self.trade_condition.setDestinationValue(self.client)
self.trade_condition.setPriceCurrencyValue(self.currency)
self.trade_condition.setPaymentConditionTradeDate('custom')
self.trade_condition.setPaymentConditionPaymentDate(DateTime(2001, 01, 01))
self.trade_condition.setPaymentConditionPaymentDate(DateTime(2001, 1, 1))
self.order.setSpecialiseValue(self.trade_condition)
self.order.Order_applyTradeCondition(self.trade_condition, force=1)
......@@ -201,7 +201,7 @@ class TestApplyTradeCondition(TradeConditionTestCase):
self.assertEqual(self.client, self.order.getDestinationValue())
self.assertEqual(self.currency, self.order.getPriceCurrencyValue())
self.assertEqual('custom', self.order.asComposedDocument().getProperty('payment_condition_trade_date'))
self.assertEqual(DateTime(2001, 01, 01),
self.assertEqual(DateTime(2001, 1, 1),
self.order.asComposedDocument().getProperty('payment_condition_payment_date'))
new_vendor = self.portal.organisation_module.newContent(
......@@ -221,7 +221,7 @@ class TestApplyTradeCondition(TradeConditionTestCase):
self.assertEqual(self.client, self.order.getDestinationValue())
self.assertEqual(self.currency, self.order.getPriceCurrencyValue())
self.assertEqual('custom', self.order.asComposedDocument().getProperty('payment_condition_trade_date'))
self.assertEqual(DateTime(2002, 02, 02),
self.assertEqual(DateTime(2002, 2, 2),
self.order.asComposedDocument().getProperty('payment_condition_payment_date'))
......
......@@ -61,7 +61,7 @@ class ERP5NodeConduit(TioSafeBaseConduit):
destination=object.getRelativeUrl(),
destination_decision=object.getRelativeUrl(),
destination_administration=object.getRelativeUrl(),
version=001)
version=0o01)
stc.validate()
def _updateSaleTradeCondition(self, object, **kw): # pylint: disable=redefined-builtin
......
......@@ -78,7 +78,7 @@ class ERP5PaymentTransactionConduit(TioSafeBaseConduit):
# Create the STC
stc = object.getPortalObject().sale_trade_condition_module.newContent(title=stc_title,
specialise=default_stc,
version=001)
version=0o01)
stc.validate()
return stc
......
......@@ -627,7 +627,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
specialise=self.business_process,
source_value = from_organisation,
destination_value = organisation,
start_date=DateTime(2019, 02, 20),
start_date=DateTime(2019, 2, 20),
)
resource_value = sequence.get('resource')
delivery.newContent( portal_type='Internal Packing List Line',
......@@ -649,7 +649,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
self.assertEqual(2, getInventoryQuantity())
inventory = self.getInventoryModule().newContent()
inventory.edit(start_date=DateTime(2019, 02, 21),
inventory.edit(start_date=DateTime(2019, 2, 21),
destination_value=organisation,
full_inventory=True)
inventory.deliver()
......@@ -694,7 +694,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
self.assertEqual(2, getInventoryQuantity())
inventory = self.getInventoryModule().newContent()
inventory.edit(start_date=DateTime(2019, 02, 21),
inventory.edit(start_date=DateTime(2019, 2, 21),
destination_value=organisation,
full_inventory=True)
inventory_line = inventory.newContent(portal_type='Inventory Line',
......
......@@ -125,7 +125,7 @@ class FTPConnector(XMLObject):
finally:
conn.logout()
def createDirectory(self, path, mode=0777):
def createDirectory(self, path, mode=0o777):
"""Create a directory `path`, with file mode `mode`.
The directory is created immediatly, even if transaction is aborted.
......
......@@ -171,7 +171,7 @@ class SFTPConnection:
raise SFTPError('%s while trying to rename "%s" to "%s" on %s.' % \
(str(msg), old_path, new_path, self.url))
def createDirectory(self, path, mode=0777):
def createDirectory(self, path, mode=0o777):
"""Create a directory `path` with mode `mode`.
"""
return self.conn.mkdir(path, mode)
......
......@@ -1960,94 +1960,94 @@ class TestMovementHistoryList(InventoryAPITestCase):
def test_FromDate(self):
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
for date in [DateTime(2006, 01, day) for day in range(1, 4)]:
for date in [DateTime(2006, 1, day) for day in range(1, 4)]:
self._makeMovement(quantity=100,
start_date=date,
stop_date=date+1)
# from_date takes all movements >=
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2006, 01, 03),
from_date=DateTime(2006, 1, 3),
section_uid=self.section.getUid())), 2)
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2006, 01, 02),
from_date=DateTime(2006, 1, 2),
section_uid=self.mirror_section.getUid())), 2)
def test_AtDate(self):
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
for date in [DateTime(2006, 01, day) for day in range(1, 4)]:
for date in [DateTime(2006, 1, day) for day in range(1, 4)]:
self._makeMovement(quantity=100,
start_date=date,
stop_date=date+1)
# at_date takes all movements <=
self.assertEqual(len(getMovementHistoryList(
at_date=DateTime(2006, 01, 03),
at_date=DateTime(2006, 1, 3),
section_uid=self.section.getUid())), 2)
self.assertEqual(len(getMovementHistoryList(
at_date=DateTime(2006, 01, 02),
at_date=DateTime(2006, 1, 2),
section_uid=self.mirror_section.getUid())), 2)
def test_ToDate(self):
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
for date in [DateTime(2006, 01, day) for day in range(1, 4)]:
for date in [DateTime(2006, 1, day) for day in range(1, 4)]:
self._makeMovement(quantity=100,
start_date=date,
stop_date=date+1)
# to_date takes all movements <
self.assertEqual(len(getMovementHistoryList(
to_date=DateTime(2006, 01, 03),
to_date=DateTime(2006, 1, 3),
section_uid=self.section.getUid())), 1)
self.assertEqual(len(getMovementHistoryList(
to_date=DateTime(2006, 01, 02),
to_date=DateTime(2006, 1, 2),
section_uid=self.mirror_section.getUid())), 1)
def test_FromDateAtDate(self):
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
for date in [DateTime(2006, 01, day) for day in range(1, 4)]:
for date in [DateTime(2006, 1, day) for day in range(1, 4)]:
self._makeMovement(quantity=100,
start_date=date,
stop_date=date+1)
# both from_date and at_date
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2006, 01, 03),
at_date=DateTime(2006, 01, 03),
from_date=DateTime(2006, 1, 3),
at_date=DateTime(2006, 1, 3),
section_uid=self.section.getUid())), 1)
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2006, 01, 02),
at_date=DateTime(2006, 01, 03),
from_date=DateTime(2006, 1, 2),
at_date=DateTime(2006, 1, 3),
section_uid=self.section.getUid())), 2)
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2005, 01, 02),
at_date=DateTime(2006, 01, 03),
from_date=DateTime(2005, 1, 2),
at_date=DateTime(2006, 1, 3),
section_uid=self.section.getUid())), 2)
# from other side
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2006, 01, 02),
at_date=DateTime(2006, 01, 03),
from_date=DateTime(2006, 1, 2),
at_date=DateTime(2006, 1, 3),
section_uid=self.mirror_section.getUid())), 2)
def test_FromDateToDate(self):
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
for date in [DateTime(2006, 01, day) for day in range(1, 4)]:
for date in [DateTime(2006, 1, day) for day in range(1, 4)]:
self._makeMovement(quantity=100,
start_date=date,
stop_date=date+1)
# both from_date and to_date
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2006, 01, 03),
to_date=DateTime(2006, 01, 03),
from_date=DateTime(2006, 1, 3),
to_date=DateTime(2006, 1, 3),
section_uid=self.section.getUid())), 0)
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2006, 01, 02),
to_date=DateTime(2006, 01, 03),
from_date=DateTime(2006, 1, 2),
to_date=DateTime(2006, 1, 3),
section_uid=self.section.getUid())), 1)
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2005, 01, 02),
to_date=DateTime(2007, 01, 02),
from_date=DateTime(2005, 1, 2),
to_date=DateTime(2007, 1, 2),
section_uid=self.section.getUid())), 3)
# from other side
self.assertEqual(len(getMovementHistoryList(
from_date=DateTime(2006, 01, 02),
to_date=DateTime(2006, 01, 03),
from_date=DateTime(2006, 1, 2),
to_date=DateTime(2006, 1, 3),
section_uid=self.mirror_section.getUid())), 1)
......@@ -2085,7 +2085,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
def test_SortOnDate(self):
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
date_list = [DateTime(2006, 01, day) for day in range(1, 10)]
date_list = [DateTime(2006, 1, day) for day in range(1, 10)]
reverse_date_list = date_list[:]
reverse_date_list.reverse()
......@@ -2194,7 +2194,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
"""Test that a running_total_quantity attribute is set on brains
"""
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
date_and_qty_list = [(DateTime(2006, 01, day), day) for day in range(1, 10)]
date_and_qty_list = [(DateTime(2006, 1, day), day) for day in range(1, 10)]
for date, quantity in date_and_qty_list:
self._makeMovement(stop_date=date, quantity=quantity)
movement_history_list = getMovementHistoryList(
......@@ -2213,7 +2213,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
"""Test that a running_total_price attribute is set on brains
"""
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
date_and_price_list = [(DateTime(2006, 01, day), day) for day in range(1, 10)]
date_and_price_list = [(DateTime(2006, 1, day), day) for day in range(1, 10)]
for date, price in date_and_price_list:
self._makeMovement(stop_date=date, quantity=1, price=price)
movement_history_list = getMovementHistoryList(
......@@ -2233,7 +2233,7 @@ class TestMovementHistoryList(InventoryAPITestCase):
value.
"""
getMovementHistoryList = self.getSimulationTool().getMovementHistoryList
date_and_qty_list = [(DateTime(2006, 01, day), day) for day in range(1, 10)]
date_and_qty_list = [(DateTime(2006, 1, day), day) for day in range(1, 10)]
for date, quantity in date_and_qty_list:
self._makeMovement(stop_date=date, price=quantity, quantity=quantity)
initial_running_total_price=100
......
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