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,73 @@
===========================
Production Request Scenario
===========================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model, Wizard
>>> from trytond.modules.company.tests.tools import create_company
>>> from trytond.tests.tools import activate_modules, assertEqual
Activate modules::
>>> config = activate_modules(
... ['stock_supply_production', 'production_routing'], create_company)
Create product::
>>> ProductUom = Model.get('product.uom')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.producible = True
>>> template.list_price = Decimal(30)
>>> template.save()
>>> product, = template.products
Create a Bill of Material with routing::
>>> BoM = Model.get('production.bom')
>>> bom = BoM(name="product")
>>> _ = bom.outputs.new(product=product, quantity=1)
>>> bom.save()
>>> Routing = Model.get('production.routing')
>>> routing = Routing(name="product")
>>> routing.boms.append(BoM(bom.id))
>>> routing.save()
>>> product_bom = product.boms.new(bom=bom, routing=routing)
>>> product.save()
Get stock locations::
>>> Location = Model.get('stock.location')
>>> storage_loc, = Location.find([('code', '=', 'STO')])
>>> lost_loc, = Location.find([('type', '=', 'lost_found')])
Create a need for product::
>>> Move = Model.get('stock.move')
>>> move = Move()
>>> move.product = product
>>> move.quantity = 1
>>> move.from_location = storage_loc
>>> move.to_location = lost_loc
>>> move.click('do')
>>> move.state
'done'
Create production request::
>>> create_pr = Wizard('stock.supply')
>>> create_pr.execute('create_')
There is now a production request with the routing::
>>> Production = Model.get('production')
>>> production, = Production.find([])
>>> assertEqual(production.routing, routing)

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 ProductionRoutingTestCase(ModuleTestCase):
'Test Production Routing module'
module = 'production_routing'
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)