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,86 @@
=====================================
Stock Product Location Place 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('stock_product_location_place', create_company)
>>> Location = Model.get('stock.location')
>>> Move = Model.get('stock.move')
>>> ProductTemplate = Model.get('product.template')
>>> UoM = Model.get('product.uom')
Get location::
>>> storage_loc, = Location.find([('code', '=', 'STO')])
>>> child_loc = Location(name="Child Location")
>>> child_loc.parent = storage_loc
>>> child_loc.code = 'CHI'
>>> child_loc.save()
Create product::
>>> unit, = UoM.find([('name', '=', "Unit")])
>>> template = ProductTemplate(name="Product")
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.list_price = Decimal('10.0000')
>>> template.save()
>>> product, = template.products
Set location places on template::
>>> location_place = template.location_places.new()
>>> location_place.location = storage_loc
>>> location_place.place = "P1"
>>> location_place = template.location_places.new()
>>> location_place.location = child_loc
>>> location_place.place = "C1"
>>> template.save()
Check places on move::
>>> move = Move(product=product)
>>> move.from_place
>>> move.to_place
>>> move.from_location = storage_loc
>>> move.from_place.rec_name
'P1'
>>> move.to_location = child_loc
>>> move.to_place.rec_name
'C1'
Set location place on product::
>>> location_place = product.location_places.new()
>>> location_place.location = storage_loc
>>> location_place.place = "P2"
>>> location_place = product.location_places.new()
>>> location_place.location = child_loc
>>> location_place.place = "C2"
>>> product.save()
Check places on move::
>>> move = Move(product=product)
>>> move.from_place
>>> move.to_place
>>> move.from_location = storage_loc
>>> move.from_place.rec_name
'P2'
>>> move.to_location = child_loc
>>> move.to_place.rec_name
'C2'

View File

@@ -0,0 +1,50 @@
=====================================
Stock Product Location Place 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('stock_product_location_place', create_company)
>>> Location = Model.get('stock.location')
>>> ProductTemplate = Model.get('product.template')
>>> UoM = Model.get('product.uom')
Get location::
>>> storage_loc, = Location.find([('code', '=', 'STO')])
Create product with location places::
>>> unit, = UoM.find([('name', '=', "Unit")])
>>> template = ProductTemplate(name="Product")
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.list_price = Decimal('10.0000')
>>> location_place = template.location_places.new()
>>> location_place.location = storage_loc
>>> location_place.place = "P1"
>>> template.save()
>>> product, = template.products
>>> location_place = product.location_places.new()
>>> location_place.location = storage_loc
>>> location_place.place = "P2"
>>> product.save()
Location places are copied when copying template::
>>> template_copy, = template.duplicate()
>>> product_copy, = template_copy.products
>>> len(template_copy.location_places)
2
>>> len(product_copy.location_places)
1

View File

@@ -0,0 +1,69 @@
==================================================
Stock Product Location Place Modification Scenario
==================================================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.modules.company.tests.tools import create_company
>>> from trytond.modules.currency.tests.tools import get_currency
>>> from trytond.tests.tools import activate_modules
Activate modules::
>>> config = activate_modules('stock_product_location_place', create_company)
>>> Location = Model.get('stock.location')
>>> Move = Model.get('stock.move')
>>> ProductTemplate = Model.get('product.template')
>>> UoM = Model.get('product.uom')
Get location::
>>> supplier_loc, = Location.find([('code', '=', 'SUP')])
>>> storage_loc, = Location.find([('code', '=', 'STO')])
Create products with different location places::
>>> unit, = UoM.find([('name', '=', "Unit")])
>>> template = ProductTemplate(name="Product")
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.list_price = Decimal('10.0000')
>>> _ = template.products.new()
>>> template.save()
>>> product1, product2 = template.products
>>> location_place1 = product1.location_places.new()
>>> location_place1.location = storage_loc
>>> location_place1.place = "P1"
>>> product1.save()
>>> location_place2 = product2.location_places.new()
>>> location_place2.location = storage_loc
>>> location_place2.place = "P2"
>>> product2.save()
Create a stock move::
>>> move = Move(product=product1)
>>> move.from_location = supplier_loc
>>> move.to_location = storage_loc
>>> move.quantity = 1
>>> move.unit_price = Decimal(10)
>>> move.currency = get_currency()
>>> move.save()
>>> move.to_place.rec_name
'P1'
Change product::
>>> move.product = product2
>>> move.save()
>>> move.to_place.rec_name
'P2'

View File

@@ -0,0 +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 trytond.tests.test_tryton import ModuleTestCase
class StockProductLocationPlaceTestCase(ModuleTestCase):
"Test Stock Product Location Place module"
module = 'stock_product_location_place'
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)