Commit af40643b authored by Mame Coumba Sall's avatar Mame Coumba Sall

Add a test to make sure that even if source and destination are not defined on...

Add a test to make sure that even if source and destination are not defined on a mvt, invoice lines are still built
parent 8c45bf7b
...@@ -1032,6 +1032,78 @@ return lambda *args, **kw: 1""") ...@@ -1032,6 +1032,78 @@ return lambda *args, **kw: 1""")
self.expense_account) self.expense_account)
self.assertEquals(1000, income_movement.getSourceCredit()) self.assertEquals(1000, income_movement.getSourceCredit())
def test_BuildTradeModelLineAndAccountingFromNoSourceNoDestinationInvoice(self):
business_process = self.createBusinessProcess()
product = self.createProductTaxed()
tax = self.createServiceTax()
currency = self.createResource('Currency', title='EUR')
trade_condition = self.createTradeCondition(
business_process, (
dict(reference='VAT',
price=.15,
resource_value=tax,
trade_phase='default/tax',
base_application='base_amount/tax'),
))
source = self.createNode()
destination = self.createNode()
invoice = self.portal.accounting_module.newContent(
portal_type=self.invoice_portal_type,
source_section_value=source,
destination_section_value=destination,
specialise_value=trade_condition,
price_currency_value=currency,
start_date=self.order_date,
stop_date=self.order_date,
created_by_builder=True)
invoice.newContent(
portal_type=self.invoice_line_portal_type,
resource_value=product,
quantity=10,
price=100)
invoice.plan()
invoice.confirm()
self.tic()
self.assertEquals(2, len(invoice.getMovementList()))
self.assertEquals(1150, invoice.getTotalPrice())
self.assertEquals([], invoice.getDivergenceList())
invoice.start()
self.tic()
self.assertEquals([], invoice.getDivergenceList())
accounting_line_list = invoice.getMovementList(
portal_type=self.invoice_transaction_line_portal_type)
self.assertEquals(3, len(accounting_line_list))
receivable_movement_list = [m for m in accounting_line_list if
m.getSourceValue() == self.receivable_account]
self.assertEquals(1, len(receivable_movement_list))
receivable_movement = receivable_movement_list[0]
self.assertEquals(receivable_movement.getDestinationValue(),
self.payable_account)
self.assertEquals(1150, receivable_movement.getSourceDebit())
collected_movement_list = [m for m in accounting_line_list if
m.getSourceValue() == self.collected_tax_account]
self.assertEquals(1, len(collected_movement_list))
collected_movement = collected_movement_list[0]
self.assertEquals(collected_movement.getDestinationValue(),
self.refundable_tax_account)
self.assertEquals(150, collected_movement.getSourceCredit())
income_movement_list = [m for m in accounting_line_list if
m.getSourceValue() == self.income_account]
self.assertEquals(1, len(income_movement_list))
income_movement = income_movement_list[0]
self.assertEquals(income_movement.getDestinationValue(),
self.expense_account)
self.assertEquals(1000, income_movement.getSourceCredit())
def test_tradeModelLineWithTargetLevelSetting(self): def test_tradeModelLineWithTargetLevelSetting(self):
""" """
Test that target level setting can specify a target of trade model line Test that target level setting can specify a target of trade model line
......
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