mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 02:32:00 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
|
|
@ -11,12 +11,17 @@ class TestEventBoothSaleCommon(TestEventBoothCommon):
|
|||
def setUpClass(cls):
|
||||
super(TestEventBoothSaleCommon, cls).setUpClass()
|
||||
|
||||
cls.env['account.tax.group'].create(
|
||||
{'name': 'Test Account Tax Group', 'company_id': cls.env.company.id}
|
||||
)
|
||||
|
||||
cls.event_booth_product = cls.env['product.product'].create({
|
||||
'name': 'Test Booth Product',
|
||||
'description_sale': 'Mighty Booth Description',
|
||||
'list_price': 20,
|
||||
'standard_price': 60.0,
|
||||
'detailed_type': 'event_booth',
|
||||
'type': 'service',
|
||||
'service_tracking': 'event_booth',
|
||||
})
|
||||
(cls.event_booth_category_1 + cls.event_booth_category_2).write({
|
||||
'product_id': cls.event_booth_product.id,
|
||||
|
|
@ -32,7 +37,6 @@ class TestEventBoothSaleCommon(TestEventBoothCommon):
|
|||
})
|
||||
cls.test_pricelist_with_discount_included = cls.env['product.pricelist'].sudo().create({
|
||||
'name': 'Test Pricelist',
|
||||
'discount_policy': 'with_discount',
|
||||
'item_ids': [
|
||||
Command.create({
|
||||
'compute_price': 'percentage',
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ class TestEventBoothSaleWData(TestEventBoothSaleCommon, TestSalesCommon):
|
|||
|
||||
cls.event_0 = cls.env['event.event'].create({
|
||||
'name': 'TestEvent',
|
||||
'auto_confirm': True,
|
||||
'date_begin': fields.Datetime.to_string(datetime.today() + timedelta(days=1)),
|
||||
'date_end': fields.Datetime.to_string(datetime.today() + timedelta(days=15)),
|
||||
'date_tz': 'Europe/Brussels',
|
||||
|
|
@ -111,9 +110,6 @@ class TestEventBoothSale(TestEventBoothSaleWData):
|
|||
self.assertEqual(
|
||||
booth.contact_name, self.event_customer.name,
|
||||
"Booth contact name should be the same as sale order customer name.")
|
||||
self.assertEqual(
|
||||
booth.contact_mobile, self.event_customer.mobile,
|
||||
"Booth contact mobile should be the same as sale order customer mobile.")
|
||||
self.assertEqual(
|
||||
booth.contact_phone, self.event_customer.phone,
|
||||
"Booth contact phone should be the same as sale order customer phone.")
|
||||
|
|
@ -137,10 +133,6 @@ class TestEventBoothSale(TestEventBoothSaleWData):
|
|||
]
|
||||
})
|
||||
|
||||
# Confirm the SO.
|
||||
sale_order.action_confirm()
|
||||
self.assertEqual(sale_order.event_booth_count, 2,
|
||||
"Event Booth Count should be equal to 2.")
|
||||
self.assertEqual(sale_order.order_line.event_booth_registration_ids.event_booth_id.ids,
|
||||
(self.booth_1 + self.booth_2).ids,
|
||||
"Booths not correctly linked with event_booth_registration.")
|
||||
|
|
@ -149,7 +141,7 @@ class TestEventBoothSale(TestEventBoothSaleWData):
|
|||
sale_order.write({
|
||||
'order_line': [
|
||||
Command.update(sale_order.order_line.id, {
|
||||
'event_booth_pending_ids':[Command.set((self.booth_2 + self.booth_3).ids)]
|
||||
'event_booth_pending_ids': [Command.set((self.booth_2 + self.booth_3).ids)]
|
||||
})
|
||||
]
|
||||
})
|
||||
|
|
@ -166,11 +158,11 @@ class TestEventBoothSale(TestEventBoothSaleWData):
|
|||
class TestEventBoothSaleInvoice(AccountTestInvoicingCommon, TestEventBoothSaleWData):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls, chart_template_ref=None):
|
||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
||||
# Add group `group_account_invoice` to user_sales_salesman to allow to pay the invoice
|
||||
cls.user_sales_salesman.groups_id += cls.env.ref('account.group_account_invoice')
|
||||
cls.user_sales_salesman.group_ids += cls.env.ref('account.group_account_invoice')
|
||||
|
||||
@users('user_sales_salesman')
|
||||
def test_event_booth_with_invoice(self):
|
||||
|
|
@ -201,12 +193,8 @@ class TestEventBoothSaleInvoice(AccountTestInvoicingCommon, TestEventBoothSaleWD
|
|||
self.assertEqual(
|
||||
sale_order.invoice_status, 'invoiced',
|
||||
f"Order is in '{sale_order.invoice_status}' status while it should be 'invoiced'.")
|
||||
# Pay the invoice.
|
||||
journal = self.env['account.journal'].search([('type', '=', 'cash'), ('company_id', '=', sale_order.company_id.id)], limit=1)
|
||||
|
||||
register_payments = self.env['account.payment.register'].with_context(active_model='account.move', active_ids=invoice.ids).create({
|
||||
'journal_id': journal.id,
|
||||
})
|
||||
register_payments = self.env['account.payment.register'].with_context(active_model='account.move', active_ids=invoice.ids).create({})
|
||||
register_payments._create_payments()
|
||||
|
||||
# Check the invoice payment state after paying the invoice
|
||||
|
|
@ -215,4 +203,8 @@ class TestEventBoothSaleInvoice(AccountTestInvoicingCommon, TestEventBoothSaleWD
|
|||
f"Invoice payment is in '{invoice.payment_state}' status while it should be '{in_payment_state}'.")
|
||||
|
||||
self.assertEqual(booth.state, 'unavailable')
|
||||
# When running without enterprise the payments get reconciled immediately.
|
||||
is_paid = self.env['account.move']._get_invoice_in_payment_state() == 'paid'
|
||||
self.assertEqual(is_paid, booth.is_paid)
|
||||
invoice._invoice_paid_hook()
|
||||
self.assertTrue(booth.is_paid)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from datetime import datetime, timedelta
|
|||
from odoo import Command
|
||||
from odoo.addons.event_booth_sale.tests.common import TestEventBoothSaleCommon
|
||||
from odoo.fields import Datetime as FieldsDatetime
|
||||
from odoo.tests.common import users, Form
|
||||
from odoo.tests import Form, users
|
||||
|
||||
|
||||
class TestEventData(TestEventBoothSaleCommon):
|
||||
|
|
@ -63,7 +63,7 @@ class TestEventData(TestEventBoothSaleCommon):
|
|||
event.event_booth_ids[1].write({'partner_id': self.event_customer.id})
|
||||
self.assertEqual(event.event_booth_count, 2)
|
||||
self.assertEqual(event.event_booth_count_available, 2)
|
||||
self.assertEqual(event.event_booth_ids[1].message_partner_ids, self.event_customer)
|
||||
self.assertEqual(event.event_booth_ids[1].message_partner_ids, self.env['res.partner'])
|
||||
|
||||
# one booth is sold
|
||||
event.event_booth_ids[1].write({'state': 'unavailable'})
|
||||
|
|
@ -77,7 +77,7 @@ class TestEventData(TestEventBoothSaleCommon):
|
|||
self.assertEqual(event.event_booth_ids[1].message_partner_ids, self.env['res.partner'])
|
||||
|
||||
# add group or the test will fail
|
||||
self.user_eventmanager.write({'groups_id': [
|
||||
self.user_eventmanager.write({'group_ids': [
|
||||
(4, self.env.ref('sales_team.group_sale_salesman').id),
|
||||
]})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue