[IMP] sale_stock: test propagation of incoterm on down-payment

Ensure that, when creating a down-payment invoice for a SO with an incoterm, this invoice should have the same incoterm as the SO.

Steps:
1. Create a SO with an incoterm
2. Create a down-payment invoice for this SO
3. The new invoice should have the same incoterm as the SO

closes odoo/odoo#122770

Opw: 3284556
X-original-commit: d854045c4d25216394a834e44f9948303529c302
Signed-off-by: malv-odoo <malv@odoo.com>
Signed-off-by: Adrien Widart (awt) <awt@odoo.com>
This commit is contained in:
Matheus Leal Viana (malv)
2023-05-30 14:16:59 +02:00
parent 7c3a3c6b70
commit 5b206c1c57
@@ -1413,6 +1413,44 @@ class TestSaleStock(TestSaleCommon, ValuationReconciliationTestCommon):
self.assertEqual(ship01.move_ids.move_orig_ids, (pick01 | pick02).move_ids)
self.assertEqual(ship02.move_ids.move_orig_ids, (pick01 | pick02).move_ids)
def test_incoterm_in_advance_payment(self):
"""When generating a advance payment invoice from a SO, this invoice incoterm should be the same as the SO"""
incoterm = self.env['account.incoterms'].create({
'name': 'Test Incoterm',
'code': 'TEST',
})
so = self.env['sale.order'].create({
'partner_id': self.partner_a.id,
'incoterm': incoterm.id,
'order_line': [(0, 0, {
'name': self.product_a.name,
'product_id': self.product_a.id,
'product_uom_qty': 10,
'product_uom': self.product_a.uom_id.id,
'price_unit': 1,
})],
})
so.action_confirm()
advance_product = self.env['product.product'].create({
'name': 'Deposit',
'type': 'service',
'invoice_policy': 'order',
})
adv_wiz = self.env['sale.advance.payment.inv'].with_context(active_ids=[so.id]).create({
'advance_payment_method': 'percentage',
'amount': 5.0,
'product_id': advance_product.id,
})
act = adv_wiz.with_context(open_invoices=True).create_invoices()
invoice = self.env['account.move'].browse(act['res_id'])
self.assertEqual(invoice.invoice_incoterm_id.id, incoterm.id)
def test_exception_delivery_partial_multi(self):
"""
When a backorder is cancelled for a picking in multi-picking,