summaryrefslogtreecommitdiff
path: root/addons/purchase_stock/tests
diff options
context:
space:
mode:
authorwilliam <wan@odoo.com>2020-03-30 11:46:27 +0000
committerwilliam <wan@odoo.com>2020-08-05 11:57:10 +0000
commit82dc0cb7b91ae59beae7e1c865b670afc5958b31 (patch)
tree949b949b249cdac265310798d5abb82675a1741b /addons/purchase_stock/tests
parent276ba8e90c87f8294286f915508766761a58d1e2 (diff)
[IMP] account: soft post entries in the future
Add an easy way to not post the entries in the future when calling post() on it, but rather set it to be auto-posted at accounting date. This is useful when we are creating a lot of entries in batch and some might be in the future, some in the past, and we don't want to separate that in two batch every time. (asset, accrual, transfer,... )
Diffstat (limited to 'addons/purchase_stock/tests')
-rw-r--r--addons/purchase_stock/tests/test_anglo_saxon_valuation_reconciliation.py10
-rw-r--r--addons/purchase_stock/tests/test_purchase_order.py4
-rw-r--r--addons/purchase_stock/tests/test_stockvaluation.py24
3 files changed, 19 insertions, 19 deletions
diff --git a/addons/purchase_stock/tests/test_anglo_saxon_valuation_reconciliation.py b/addons/purchase_stock/tests/test_anglo_saxon_valuation_reconciliation.py
index 58434bd0a54..6cb9aca889f 100644
--- a/addons/purchase_stock/tests/test_anglo_saxon_valuation_reconciliation.py
+++ b/addons/purchase_stock/tests/test_anglo_saxon_valuation_reconciliation.py
@@ -10,7 +10,7 @@ class TestValuationReconciliation(ValuationReconciliationTestCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
-
+
cls.stock_account_product_categ.property_account_creditor_price_difference_categ = cls.company_data['default_account_stock_price_diff']
@classmethod
@@ -65,7 +65,7 @@ class TestValuationReconciliation(ValuationReconciliationTestCommon):
self._process_pickings(purchase_order.picking_ids, date=date_po_and_delivery)
invoice = self._create_invoice_for_po(purchase_order, '2018-02-02')
- invoice.post()
+ invoice.action_post()
picking = self.env['stock.picking'].search([('purchase_id','=',purchase_order.id)])
self.check_reconciliation(invoice, picking)
# cancel the invoice
@@ -85,7 +85,7 @@ class TestValuationReconciliation(ValuationReconciliationTestCommon):
invoice = move_form.save()
# Validate the invoice and refund the goods
- invoice.post()
+ invoice.action_post()
self._process_pickings(purchase_order.picking_ids, date='2017-12-24')
picking = self.env['stock.picking'].search([('purchase_id', '=', purchase_order.id)])
self.check_reconciliation(invoice, picking)
@@ -130,7 +130,7 @@ class TestValuationReconciliation(ValuationReconciliationTestCommon):
with move_form.invoice_line_ids.edit(0) as line_form:
line_form.quantity = 3.0
invoice = move_form.save()
- invoice.post()
+ invoice.action_post()
self.check_reconciliation(invoice, picking, full_reconcile=False)
invoice2 = self._create_invoice_for_po(purchase_order, '2017-02-15')
@@ -138,7 +138,7 @@ class TestValuationReconciliation(ValuationReconciliationTestCommon):
with move_form.invoice_line_ids.edit(0) as line_form:
line_form.quantity = 2.0
invoice2 = move_form.save()
- invoice2.post()
+ invoice2.action_post()
self.check_reconciliation(invoice2, picking, full_reconcile=False)
# We don't need to make the date of processing explicit since the very last rate
diff --git a/addons/purchase_stock/tests/test_purchase_order.py b/addons/purchase_stock/tests/test_purchase_order.py
index 4837de135b6..c1e958ffb41 100644
--- a/addons/purchase_stock/tests/test_purchase_order.py
+++ b/addons/purchase_stock/tests/test_purchase_order.py
@@ -109,7 +109,7 @@ class TestPurchaseOrder(ValuationReconciliationTestCommon):
move_form.partner_id = self.partner_a
move_form.purchase_id = self.po
self.invoice = move_form.save()
- self.invoice.post()
+ self.invoice.action_post()
self.assertEqual(self.po.order_line.mapped('qty_invoiced'), [5.0, 5.0], 'Purchase: all products should be invoiced"')
@@ -145,7 +145,7 @@ class TestPurchaseOrder(ValuationReconciliationTestCommon):
with move_form.invoice_line_ids.edit(1) as line_form:
line_form.quantity = 2.0
self.invoice = move_form.save()
- self.invoice.post()
+ self.invoice.action_post()
self.assertEqual(self.po.order_line.mapped('qty_invoiced'), [3.0, 3.0], 'Purchase: Billed quantity should be 3.0')
diff --git a/addons/purchase_stock/tests/test_stockvaluation.py b/addons/purchase_stock/tests/test_stockvaluation.py
index aefd53a1afd..e2972a456a4 100644
--- a/addons/purchase_stock/tests/test_stockvaluation.py
+++ b/addons/purchase_stock/tests/test_stockvaluation.py
@@ -382,7 +382,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
move_form.partner_id = self.partner_id
move_form.purchase_id = po1
invoice_po1 = move_form.save()
- invoice_po1.post()
+ invoice_po1.action_post()
# Receive 10@20 ; create the vendor bill
po2 = self.env['purchase.order'].create({
@@ -407,7 +407,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
move_form.partner_id = self.partner_id
move_form.purchase_id = po2
invoice_po2 = move_form.save()
- invoice_po2.post()
+ invoice_po2.action_post()
# valuation of product1 should be 300
self.assertEqual(self.product1.value_svl, 300)
@@ -433,7 +433,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
with move_form.invoice_line_ids.edit(0) as line_form:
line_form.quantity = 10
creditnote_po2 = move_form.save()
- creditnote_po2.post()
+ creditnote_po2.action_post()
# check the anglo saxon entries
price_diff_entry = self.env['account.move.line'].search([('account_id', '=', self.price_diff_account.id)])
@@ -467,7 +467,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
with move_form.invoice_line_ids.edit(0) as line_form:
line_form.price_unit = 15.0
invoice = move_form.save()
- invoice.post()
+ invoice.action_post()
# Check what was posted in the price difference account
price_diff_aml = self.env['account.move.line'].search([('account_id','=', self.price_diff_account.id)])
@@ -590,7 +590,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
})]
})
- inv.post()
+ inv.action_post()
move_lines = inv.line_ids
self.assertEqual(len(move_lines), 2)
@@ -734,7 +734,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
]
})
- inv.post()
+ inv.action_post()
for p in patchers:
p.stop()
@@ -898,7 +898,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
]
})
- inv.post()
+ inv.action_post()
for p in patchers:
p.stop()
@@ -1074,7 +1074,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
]
})
- inv.post()
+ inv.action_post()
today = date_delivery1
backorder_picking = self.env['stock.picking'].search([('backorder_id', '=', picking.id)])
@@ -1104,7 +1104,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
]
})
- inv1.post()
+ inv1.action_post()
for p in patchers:
p.stop()
@@ -1216,7 +1216,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
line_form.price_unit = 100.0
line_form.discount = 10.0
invoice = invoice_form.save()
- invoice.post()
+ invoice.action_post()
# Check what was posted in the price difference account
price_diff_aml = self.env['account.move.line'].search([('account_id','=', self.price_diff_account.id)])
@@ -1262,7 +1262,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
line_form.tax_ids.clear()
line_form.discount = 10.0
invoice = invoice_form.save()
- invoice.post()
+ invoice.action_post()
# Check what was posted in the price difference account
price_diff_aml = self.env['account.move.line'].search([('account_id', '=', self.price_diff_account.id)])
@@ -1308,7 +1308,7 @@ class TestStockValuationWithCOA(AccountTestInvoicingCommon):
line_form.price_unit = 100.0
line_form.discount = 10.0
invoice = invoice_form.save()
- invoice.post()
+ invoice.action_post()
# Check if something was posted in the price difference account
price_diff_aml = self.env['account.move.line'].search([('account_id','=', self.price_diff_account.id)])