first commit

This commit is contained in:
root
2026-03-14 09:42:12 +00:00
commit 0adbd20c2c
10991 changed files with 1646955 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

View File

@@ -0,0 +1,88 @@
=================================
Quality Control Shipment Scenario
=================================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.modules.company.tests.tools import create_company
>>> from trytond.tests.tools import activate_modules
Activate modules::
>>> config = activate_modules(['quality', 'stock'], create_company)
>>> Control = Model.get('quality.control')
>>> Inspection = Model.get('quality.inspection')
>>> Party = Model.get('party.party')
>>> ProductTemplate = Model.get('product.template')
>>> Shipment = Model.get('stock.shipment.in')
>>> UoM = Model.get('product.uom')
Create party::
>>> supplier = Party(name="Supplier")
>>> supplier.save()
Create product::
>>> unit, = UoM.find([('name', '=', "Unit")])
>>> product_template = ProductTemplate(name="Product")
>>> product_template.default_uom = unit
>>> product_template.type = 'goods'
>>> product_template.save()
>>> product, = product_template.products
Create control::
>>> control = Control(name="Check")
>>> control.operations = ['stock.shipment.in:receive']
>>> point = control.points.new()
>>> point.string = "Test"
>>> point.type_ = 'float'
>>> point.tolerance_lower = 20
>>> point.tolerance_upper = 50
>>> control.save()
Receive product which fails quality inspection::
>>> shipment = Shipment(supplier=supplier)
>>> move = shipment.incoming_moves.new()
>>> move.from_location = shipment.supplier_location
>>> move.to_location = shipment.warehouse_input
>>> move.product = product
>>> move.quantity = 1
>>> move.unit_price = Decimal('5.0000')
>>> move.currency = shipment.company.currency
>>> shipment.save()
>>> shipment.state
'draft'
>>> inspect = shipment.click('receive')
>>> inspect.form.points = {'test': 60}
>>> inspect.execute('save')
>>> inspect.state
'end'
>>> shipment.state
'draft'
>>> inspection, = Inspection.find([])
>>> inspection.state
'failed'
>>> shipment.click('receive')
Traceback (most recent call last):
...
InspectionError: ...
Receive a product that passes quantity inspection::
>>> inspection.click('pass_')
>>> inspection.state
'passed'
>>> shipment.click('receive')
>>> shipment.state
'received'

View File

@@ -0,0 +1,106 @@
===========================
Quality Inspection Scenario
===========================
Imports::
>>> from proteus import Model
>>> from trytond.modules.company.tests.tools import create_company
>>> from trytond.tests.tools import activate_modules
Activate modules::
>>> config = activate_modules('quality', create_company)
>>> Control = Model.get('quality.control')
>>> Inspection = Model.get('quality.inspection')
Create control::
>>> control = Control(name="Test")
>>> point = control.points.new()
>>> point.string = "Boolean"
>>> point.type_ = 'boolean'
>>> point = control.points.new()
>>> point.string = "Float"
>>> point.type_ = 'float'
>>> point.tolerance_lower = 10
>>> point.tolerance_upper = 20
>>> control.save()
Create an inspection that passes::
>>> inspection = Inspection()
>>> inspection.control = control
>>> inspection.points
{'boolean': None, 'float': None}
>>> inspection.points = {'boolean': True, 'float': 15}
>>> inspection.click('process')
>>> inspection.state
'passed'
Create an inspection that fails::
>>> inspection = Inspection()
>>> inspection.control = control
>>> inspection.points = {'boolean': False, 'float': 15}
>>> inspection.click('process')
>>> inspection.state
'failed'
Create an inspection below the lower tolerance::
>>> inspection = Inspection()
>>> inspection.control = control
>>> inspection.points = {'boolean': True, 'float': 5}
>>> inspection.click('process')
>>> inspection.state
'failed'
Create an inspection above the upper tolerance::
>>> inspection = Inspection()
>>> inspection.control = control
>>> inspection.points = {'boolean': True, 'float': 25}
>>> inspection.click('process')
>>> inspection.state
'failed'
Create a partial inspection::
>>> inspection = Inspection()
>>> inspection.control = control
>>> inspection.points = {'boolean': True}
>>> inspection.click('process')
Traceback (most recent call last):
...
InspectionValidationError: ...
Pass a failed inspection::
>>> inspection = Inspection()
>>> inspection.control = control
>>> inspection.points = {'boolean': False, 'float': 15}
>>> inspection.click('process')
>>> inspection.state
'failed'
>>> inspection.click('pass_')
>>> inspection.state
'passed'
Its not possible to delete a passed inspection::
>>> inspection.delete()
Traceback (most recent call last):
...
AccessError: ...
Reset an inspection back to pending::
>>> inspection.click('pending')
>>> inspection.state
'pending'
It is possible to delete pending inspections::
>>> inspection.delete()

View File

@@ -0,0 +1,12 @@
# 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
class QualityTestCase(ModuleTestCase):
"Test Quality module"
module = 'quality'
extras = ['stock', 'production']
del ModuleTestCase

View File

@@ -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)