Test extension of invoice and shipment grouping fields
This commit is contained in:
1 parent
84318913c7
commit
f8a6d08b20
5 files changed
+66
-6
No files matched your search
@@ -1,8 +1,11 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from trytond.modules.company.tests import CompanyTestMixin
|
||||
from trytond.tests.test_tryton import ModuleTestCase
|
||||
from trytond.pool import Pool
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
|
||||
|
||||
class IncotermTestCase(CompanyTestMixin, ModuleTestCase):
|
||||
@@ -14,5 +17,20 @@ class IncotermTestCase(CompanyTestMixin, ModuleTestCase):
|
||||
'sale_shipment_grouping', 'stock', 'account_invoice',
|
||||
'account_invoice_stock']
|
||||
|
||||
@with_transaction()
|
||||
def test_shipment_grouping(self):
|
||||
"Test fields to group shipment"
|
||||
pool = Pool()
|
||||
Sale = pool.get('sale.sale')
|
||||
ShipmentOut = pool.get('stock.shipment.out')
|
||||
|
||||
sale = Sale()
|
||||
shipment = MagicMock(spec=ShipmentOut)
|
||||
|
||||
fields = sale._get_shipment_grouping_fields(shipment)
|
||||
|
||||
self.assertLessEqual({'incoterm', 'incoterm_location'}, set(fields))
|
||||
self.assertLessEqual(set(fields), ShipmentOut._fields.keys())
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
@@ -50,7 +50,10 @@ for dep in info.get('depends', []):
|
||||
requires.append(get_require_version('trytond_%s' % dep))
|
||||
requires.append(get_require_version('trytond'))
|
||||
|
||||
tests_require = [get_require_version('proteus')]
|
||||
tests_require = [
|
||||
get_require_version('proteus'),
|
||||
get_require_version('trytond_sale_invoice_grouping'),
|
||||
]
|
||||
|
||||
setup(name=name,
|
||||
version=version,
|
||||
|
||||
@@ -1,12 +1,31 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.tests.test_tryton import ModuleTestCase
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from trytond.pool import Pool
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
|
||||
|
||||
class SaleInvoiceDateTestCase(ModuleTestCase):
|
||||
'Test Sale Invoice Date module'
|
||||
module = 'sale_invoice_date'
|
||||
extras = ['sale_invoice_grouping']
|
||||
|
||||
@with_transaction()
|
||||
def test_invoice_grouping(self):
|
||||
"Test fields to group invoice"
|
||||
pool = Pool()
|
||||
Sale = pool.get('sale.sale')
|
||||
Invoice = pool.get('account.invoice')
|
||||
|
||||
sale = Sale()
|
||||
invoice = MagicMock(spec=Invoice)
|
||||
|
||||
fields = sale._get_invoice_grouping_fields(invoice)
|
||||
|
||||
self.assertIn('invoice_date', fields)
|
||||
self.assertLessEqual(set(fields), Invoice._fields.keys())
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
@@ -50,7 +50,9 @@ requires.append(get_require_version('trytond'))
|
||||
tests_require = [
|
||||
get_require_version('proteus'),
|
||||
]
|
||||
for dep in ['account', 'party', 'stock', 'sale_promotion']:
|
||||
for dep in [
|
||||
'account', 'party', 'stock', 'sale_promotion',
|
||||
'sale_shipment_grouping']:
|
||||
tests_require.append(get_require_version('trytond_%s' % dep))
|
||||
|
||||
setup(name=name,
|
||||
|
||||
@@ -1,13 +1,31 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.tests.test_tryton import ModuleTestCase
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from trytond.pool import Pool
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
|
||||
|
||||
class SaleShipmentCostTestCase(ModuleTestCase):
|
||||
'Test Sale Shipment Cost module'
|
||||
module = 'sale_shipment_cost'
|
||||
extras = ['sale_promotion']
|
||||
extras = ['sale_promotion', 'sale_shipment_grouping']
|
||||
|
||||
@with_transaction()
|
||||
def test_shipment_grouping(self):
|
||||
"Test fields to group shipment"
|
||||
pool = Pool()
|
||||
Sale = pool.get('sale.sale')
|
||||
ShipmentOut = pool.get('stock.shipment.out')
|
||||
|
||||
sale = Sale()
|
||||
shipment = MagicMock(spec=ShipmentOut)
|
||||
|
||||
fields = sale._get_shipment_grouping_fields(shipment)
|
||||
|
||||
self.assertLessEqual({'cost_method', 'carrier'}, set(fields))
|
||||
self.assertLessEqual(set(fields), ShipmentOut._fields.keys())
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
Reference in new issue
Block a user