Create Sale Order

This commit is contained in:
2025-01-20 22:40:03 -05:00
commit de6b2e3c14
29 changed files with 1301 additions and 0 deletions

0
tests/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,44 @@
=====================
Sale Order Scenario
=====================
Imports::
>>> from proteus import Model
>>> from trytond.tests.tools import activate_modules
>>> from decimal import Decimal
>>> from trytond.modules.company.tests.tools import create_company
Activate module::
>>> config = activate_modules('sale_order', create_company)
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Cristian')
>>> party.save()
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.list_price = Decimal('10')
>>> template.save()
>>> product, = template.products
Create order::
>>> SaleOrder = Model.get('sale.order')
>>> order = SaleOrder()
>>> order.party = party
>>> order.pickup_location = "on_site"
>>> order.save()
>>> line1 = order.lines.new()
>>> line1.product = product
>>> line1.quantity = 4
>>> line1.unitprice = 8400
>>> line1.total_amount = 33600
>>> order.save()

10
tests/test_module.py Normal file
View File

@@ -0,0 +1,10 @@
from trytond.tests.test_tryton import ModuleTestCase
class SaleOrderTestCase(ModuleTestCase):
"Test Sale Order module"
module = 'sale_order'
del ModuleTestCase

8
tests/test_scenario.py Normal file
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)