Commit edab9781 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: No need trade condition for manual accounting

  The trade condition is only mandatory for automated invoices, if the accountant does things manually, it is
  not required to create/use one.
parent dbdf7335
Pipeline #36876 failed with stage
in 0 seconds
...@@ -40,12 +40,24 @@ ...@@ -40,12 +40,24 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>sale_invoice_specialise_sale_trade_condition_constraint_constraint</string> </value> <value> <string>sale_invoice_specialise_sale_trade_condition_constraint_constraint</string> </value>
</item> </item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>max_arity</string> </key> <key> <string>max_arity</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item> <item>
<key> <string>min_arity</string> </key> <key> <string>min_arity</string> </key>
<value> <int>1</int> </value> <value> <int>1</int> </value>
...@@ -54,6 +66,22 @@ ...@@ -54,6 +66,22 @@
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value> <value> <string>Category Membership Arity Constraint</string> </value>
</item> </item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>test_tales_expression</string> </key>
<value> <string>python: context.getLedger() == \'automated\'</string> </value>
</item>
<item> <item>
<key> <string>use_acquisition</string> </key> <key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
......
...@@ -134,6 +134,12 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin): ...@@ -134,6 +134,12 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
setter = invoice.setSpecialise setter = invoice.setSpecialise
message = "Arity Error for Relation ['specialise'] and Type "\ message = "Arity Error for Relation ['specialise'] and Type "\
"('Sale Trade Condition',), arity is equal to 0 but should be at least 1" "('Sale Trade Condition',), arity is equal to 0 but should be at least 1"
self.assertNotIn(message, self.getMessageList(invoice))
invoice = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction',
ledger='automated')
setter = invoice.setSpecialise
self.assertIn(message, self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
sale_condition = self.portal.sale_trade_condition_module.newContent( sale_condition = self.portal.sale_trade_condition_module.newContent(
...@@ -153,6 +159,11 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin): ...@@ -153,6 +159,11 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
portal_type='Sale Invoice Transaction') portal_type='Sale Invoice Transaction')
message = "Arity Error for Relation ['specialise'] and Type " + \ message = "Arity Error for Relation ['specialise'] and Type " + \
"('Sale Trade Condition',), arity is equal to 0 but should be at least 1" "('Sale Trade Condition',), arity is equal to 0 but should be at least 1"
self.assertNotIn(message, self.getMessageList(invoice))
invoice = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction',
ledger='automated')
self.assertIn(message, self.getMessageList(invoice)) self.assertIn(message, self.getMessageList(invoice))
sale_condition = self.portal.sale_trade_condition_module.newContent( sale_condition = self.portal.sale_trade_condition_module.newContent(
......
...@@ -405,20 +405,6 @@ class TestSlapOSManualAccountingScenario(TestSlapOSManualAccountingScenarioMixin ...@@ -405,20 +405,6 @@ class TestSlapOSManualAccountingScenario(TestSlapOSManualAccountingScenarioMixin
accountant_person, accountant_organisation, bank_account, currency = \ accountant_person, accountant_organisation, bank_account, currency = \
self.bootstrapManualAccountingTest() self.bootstrapManualAccountingTest()
# Create required trade condition for manual accounting.
self.login()
business_process_module = self.portal.business_process_module
trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type='Sale Trade Condition',
trade_condition_type='default',
reference='manual_accounting_for_%s' % accountant_person.getReference(),
specialise_value=business_process_module.slapos_manual_accounting_business_process
)
self.portal.portal_workflow.doActionFor(trade_condition, 'validate_action')
self.assertEqual(trade_condition.checkConsistency(), [])
self.tic()
self.login(accountant_person.getUserId())
# Accountant can create one account for Remboursement of a customer # Accountant can create one account for Remboursement of a customer
account = self.portal.account_module.newContent( account = self.portal.account_module.newContent(
...@@ -453,8 +439,7 @@ class TestSlapOSManualAccountingScenario(TestSlapOSManualAccountingScenarioMixin ...@@ -453,8 +439,7 @@ class TestSlapOSManualAccountingScenario(TestSlapOSManualAccountingScenarioMixin
resource_value=currency, resource_value=currency,
price_currency_value=currency, price_currency_value=currency,
destination_section_value=customer, destination_section_value=customer,
source_section_value=accountant_organisation, source_section_value=accountant_organisation
specialise_value=trade_condition
) )
total_amount = 9876.30 total_amount = 9876.30
......
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