Add test scenario for production split

This commit is contained in:
Cédric Krier
2024-05-20 20:35:26 +02:00
parent e1a63d4c39
commit 660eafe90c
3 changed files with 68 additions and 1 deletions
+3 -1
View File
@@ -47,7 +47,9 @@ for dep in info.get('depends', []):
requires.append(get_require_version('trytond_%s' % dep))
requires.append(get_require_version('trytond'))
tests_require = []
tests_require = [
get_require_version('proteus'),
]
setup(name=name,
version=version,
@@ -0,0 +1,57 @@
=========================
Production Split Scenario
=========================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.modules.company.tests.tools import create_company, get_company
>>> from trytond.tests.tools import activate_modules
Activate modules::
>>> config = activate_modules('production_split')
>>> ProductTemplate = Model.get('product.template')
>>> ProductUom = Model.get('product.uom')
>>> Production = Model.get('production')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create product::
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.producible = True
>>> template.list_price = Decimal(20)
>>> template.save()
>>> product, = template.products
Create a production::
>>> production = Production()
>>> production.product = product
>>> production.quantity = 10
>>> production.save()
Split the production::
>>> split_production = production.click('split_wizard')
>>> split_production.form.quantity = 4
>>> split_production.form.count = 1
>>> split_production.execute('split')
>>> production2, = Production.find([('id', '!=', production.id)])
>>> production.quantity
4.0
>>> production2.quantity
6.0
@@ -0,0 +1,8 @@
# 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 load_doc_tests
def load_tests(*args, **kwargs):
return load_doc_tests(__name__, __file__, *args, **kwargs)