invoice seq nb
This commit is contained in:
@@ -1890,8 +1890,7 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin, InvoiceReportMixin):
|
|||||||
cls._check_taxes(invoices)
|
cls._check_taxes(invoices)
|
||||||
# cls._check_similar(invoices)
|
# cls._check_similar(invoices)
|
||||||
|
|
||||||
invoices_in = cls.browse([i for i in invoices if i.type == 'in'])
|
cls.set_number(invoices)
|
||||||
cls.set_number(invoices_in)
|
|
||||||
cls._store_cache(invoices)
|
cls._store_cache(invoices)
|
||||||
|
|
||||||
moves = []
|
moves = []
|
||||||
|
|||||||
@@ -290,5 +290,32 @@ class AccountInvoiceTestCase(
|
|||||||
clean_moves.assert_called_once_with([move])
|
clean_moves.assert_called_once_with([move])
|
||||||
save_invoices.assert_called()
|
save_invoices.assert_called()
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_validate_invoice_sets_number_for_customer_invoice(self):
|
||||||
|
'validating customer invoices now assigns the invoice number'
|
||||||
|
Invoice = Pool().get('account.invoice')
|
||||||
|
|
||||||
|
move = Mock()
|
||||||
|
invoice = Invoice()
|
||||||
|
invoice.type = 'out'
|
||||||
|
invoice.move = None
|
||||||
|
invoice.get_move = Mock(return_value=move)
|
||||||
|
invoice.do_lot_invoicing = Mock()
|
||||||
|
|
||||||
|
move_model = Mock()
|
||||||
|
|
||||||
|
with patch.object(Invoice, '_check_taxes'), patch.object(
|
||||||
|
Invoice, '_store_cache'), patch.object(
|
||||||
|
Invoice, 'set_number') as set_number, patch.object(
|
||||||
|
Invoice, 'cleanMoves'), patch.object(
|
||||||
|
Invoice, 'save'), patch(
|
||||||
|
'trytond.modules.account_invoice.invoice.Pool'
|
||||||
|
) as PoolMock:
|
||||||
|
PoolMock.return_value.get.return_value = move_model
|
||||||
|
|
||||||
|
Invoice.validate_invoice([invoice])
|
||||||
|
|
||||||
|
set_number.assert_called_once_with([invoice])
|
||||||
|
|
||||||
|
|
||||||
del ModuleTestCase
|
del ModuleTestCase
|
||||||
|
|||||||
Reference in New Issue
Block a user