Add suport of gift card for ecommerce.
Split the generic part to allow others modules to us it (e.g. pos)
A customer buy 1 Gift Card, he receive a code by mail and see it into the
sale order.
Another customer can now use this code in the payment step to deduce this
amount.
Product Gift card is sold by default without tax, because we don't know on wich
ecommerce, the shipping address ans sot the tax that will be used.
So the tax is deduce from the sale order that use the gift card.
We considere to be in the MPV case from:
https://www.vandelanotte.be/fr/actuel/actualites/624-les-bons-soumis-a-un-nouveau-regime-de-tva-a-partir-de-2019
Courtesy of @bvr-odoo for the email and product image
Co-Reviewed by @rde-odoo and @jke-be
task-2428004
pr-64195
closes odoo/odoo#64195
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.addons.sale.tests.test_sale_product_attribute_value_config import TestSaleProductAttributeValueCommon
|
|
|
|
|
|
class TestSaleGiftCardCommon(TestSaleProductAttributeValueCommon):
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super().setUpClass()
|
|
|
|
# set currency to not rely on demo data and avoid possible race condition
|
|
cls.currency_ratio = 1.0
|
|
pricelist = cls.env.ref("product.list0")
|
|
pricelist.currency_id = cls._setup_currency(cls.currency_ratio)
|
|
|
|
|
|
# create partner for sale order.
|
|
cls.fatima = cls.env['res.partner'].create({
|
|
'name': 'Fatima Kalai',
|
|
'email': 'fatima.kalai@example.com',
|
|
})
|
|
|
|
cls.empty_order = cls.env['sale.order'].create({
|
|
'partner_id': cls.fatima.id
|
|
})
|
|
|
|
cls.uom_unit = cls.env.ref('uom.product_uom_unit')
|
|
|
|
# Taxes
|
|
cls.tax_15pc_excl = cls.env['account.tax'].create({
|
|
'name': "Tax 15%",
|
|
'amount_type': 'percent',
|
|
'amount': 15,
|
|
'type_tax_use': 'sale',
|
|
})
|
|
|
|
#products
|
|
cls.product_A = cls.env['product.product'].create({
|
|
'name': 'Product A',
|
|
'list_price': 100,
|
|
'sale_ok': True,
|
|
'taxes_id': [(6, 0, [cls.tax_15pc_excl.id])],
|
|
})
|
|
cls.product_gift_card = cls.env['product.product'].create({
|
|
'name': 'Gift Card 50',
|
|
'list_price': 50,
|
|
'sale_ok': True,
|
|
'taxes_id': False,
|
|
'is_gift_card': True
|
|
})
|