[FIX] purchase: update tests to effectively create invoices of type purchase, not
Default value is out_invoice aka an invoice of type sale. However here we would like to test invoices of type purchase. Otherwise extending tests for specific purchase-related invoice code is not possible. This is done using the magical context key type. Closes #15886
This commit is contained in:
committed by
Thibault Delavallée
parent
8a76d4581c
commit
82fbe03ff8
@@ -76,10 +76,11 @@ class TestPurchaseOrder(AccountingTestCase):
|
||||
self.picking.do_new_transfer()
|
||||
self.assertEqual(self.po.order_line.mapped('qty_received'), [5.0, 5.0], 'Purchase: all products should be received"')
|
||||
|
||||
self.invoice = self.AccountInvoice.create({
|
||||
'partner_id': self.partner_id.id,
|
||||
'purchase_id': self.po.id,
|
||||
'account_id': self.partner_id.property_account_payable_id.id,
|
||||
})
|
||||
self.invoice = self.AccountInvoice.with_context(
|
||||
type='in_invoice').create({
|
||||
'partner_id': self.partner_id.id,
|
||||
'purchase_id': self.po.id,
|
||||
'account_id': self.partner_id.property_account_payable_id.id,
|
||||
})
|
||||
self.invoice.purchase_order_change()
|
||||
self.assertEqual(self.po.order_line.mapped('qty_invoiced'), [5.0, 5.0], 'Purchase: all products should be invoiced"')
|
||||
|
||||
Reference in New Issue
Block a user