From 7d8bcf09174cd1eb15b4d0239b3d7ed93860dda7 Mon Sep 17 00:00:00 2001 From: Mongar28 Date: Tue, 13 Aug 2024 15:18:54 -0500 Subject: [PATCH] Fead: Se crean las pruebas hasta configurar algunas 'sales' --- .gitignore | 229 ++++++++++++++++++ __pycache__/__init__.cpython-311.pyc | Bin 698 -> 698 bytes tests/__pycache__/test_module.cpython-311.pyc | Bin 581 -> 581 bytes .../__pycache__/test_scenario.cpython-311.pyc | Bin 480 -> 480 bytes tests/scenario_sale_line_delete_log.rst | 164 +++++++++++-- tryton.cfg | 1 + 6 files changed, 379 insertions(+), 15 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d9fc84 --- /dev/null +++ b/.gitignore @@ -0,0 +1,229 @@ +# ---> Python +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class +*.bk + +/.vscode + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +bin/ +include/ +wheels/ +__pycache__ +trytond_miac.egg-info/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script fkrom a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# ---> Emacs +# -*- mode: gitignore; -*- +*~ +.~* +*# +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + + +# ---> Vim +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# ---> VirtualEnv +# Virtualenv +# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +.Python +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +pyvenv.cfg +.venv +pip-selfcheck.json + +.tdd_cache +app + diff --git a/__pycache__/__init__.cpython-311.pyc b/__pycache__/__init__.cpython-311.pyc index 8be08261155ec747d8c8f8a414279d948081af80..8b034ab8688deb2bfc0b460514798c39925e5460 100644 GIT binary patch delta 19 ZcmdnRx{H--IWI340}yOkvyp29696(O1t9>tZ1i=6R diff --git a/tests/__pycache__/test_module.cpython-311.pyc b/tests/__pycache__/test_module.cpython-311.pyc index 34f293c78ab41a60c037db7511e9933adcda5cba..d6503ab0baf52a8ea0bf90c7915c0a93a1a404e5 100644 GIT binary patch delta 19 ZcmX@ga+HN@IWI340}yOkvysc12>>#v1i%0Q delta 19 ZcmX@ga+HN@IWI340}zC*+Q?BLFvt1&#m! delta 19 ZcmaFB{D7HjIWI340}zC*+Q@Z{5dbww1ug&p diff --git a/tests/scenario_sale_line_delete_log.rst b/tests/scenario_sale_line_delete_log.rst index e967ea3..92f2e5c 100644 --- a/tests/scenario_sale_line_delete_log.rst +++ b/tests/scenario_sale_line_delete_log.rst @@ -4,32 +4,166 @@ Sale Line Delete Log Scenario Imports:: - >>> from proteus import Model, Wizard - >>> from trytond.tests.tools import activate_modules - >>> from trytond.modules.company.tests.tools import create_company, get_company - >>> from trytond.modules.account.tests.tools import ( - ... create_chart, create_fiscalyear, get_accounts) - >>> import datetime as dt - >>> today = dt.date.today() - - + >>> from decimal import Decimal + >>> from proteus import Model, Wizard + >>> from trytond.tests.tools import activate_modules + >>> from trytond.modules.company.tests.tools import create_company, get_company + >>> from trytond.modules.account.tests.tools import ( + ... create_chart, create_fiscalyear, create_tax, get_accounts) + >>> from trytond.modules.account_invoice.tests.tools import ( + ... create_payment_term, set_fiscalyear_invoice_sequences) + >>> import datetime as dt + >>> today = dt.date.today() + >>> from trytond.tests.tools import set_user Activate modules:: >>> config = activate_modules('sale_line_delete_log') +Initial data:: + + >>> User = Model.get('res.user') + >>> Party = Model.get('party.party') + >>> Employee = Model.get('company.employee') + >>> Journal = Model.get('account.journal') + >>> PaymentMethod = Model.get('account.invoice.payment.method') + >>> Party = Model.get('party.party') + >>> ProductUom = Model.get('product.uom') + >>> ProductTemplate = Model.get('product.template') + >>> Sale = Model.get('sale.sale') + >>> SaleLine = Model.get('sale.line') Create company:: >>> _ = create_company() >>> company = get_company() -Create fiscal years:: +Set employee:: - >>> fiscalyear = create_fiscalyear(company, today) + >>> employee_party = Party(name="Employee") + >>> employee_party.save() + >>> employee = Employee(party=employee_party) + >>> employee.save() + >>> user = User(config.user) + >>> user.employees.append(employee) + >>> user.employee = employee + >>> user.save() + >>> set_user(user.id) + +Create fiscal year:: + + >>> fiscalyear = set_fiscalyear_invoice_sequences(create_fiscalyear(company, today)) >>> fiscalyear.click('create_period') - >>> periods = fiscalyear.periods - >>> len(periods) - 12 - >>> period_1, period_3, period_5 = periods[0], periods[2], periods[4] + +Create chart of accounts:: + + >>> _ = create_chart(company) + >>> accounts = get_accounts(company) + >>> revenue = accounts['revenue'] + >>> expense = accounts['expense'] + >>> cash = accounts['cash'] + + >>> cash_journal, = Journal.find([('type', '=', 'cash')]) + >>> cash_journal.save() + >>> payment_method = PaymentMethod() + >>> payment_method.name = 'Cash' + >>> payment_method.journal = cash_journal + >>> payment_method.credit_account = cash + >>> payment_method.debit_account = cash + >>> payment_method.save() + +Create tax:: + + >>> tax = create_tax(Decimal('.10')) + >>> tax.save() + +Create parties:: + + >>> supplier = Party(name='Supplier') + >>> supplier.save() + >>> customer = Party(name='Customer') + >>> customer.save() + +Create account categories:: + + >>> ProductCategory = Model.get('product.category') + >>> account_category = ProductCategory(name="Account Category") + >>> account_category.accounting = True + >>> account_category.account_expense = expense + >>> account_category.account_revenue = revenue + >>> account_category.save() + + >>> account_category_tax, = account_category.duplicate() + >>> account_category_tax.customer_taxes.append(tax) + >>> account_category_tax.save() + +Create product:: + + >>> unit, = ProductUom.find([('name', '=', 'Unit')]) + + >>> template = ProductTemplate() + >>> template.name = 'product' + >>> template.default_uom = unit + >>> template.type = 'goods' + >>> template.salable = True + >>> template.list_price = Decimal('10') + >>> template.account_category = account_category_tax + >>> template.save() + >>> product, = template.products + + >>> template = ProductTemplate() + >>> template.name = 'service' + >>> template.default_uom = unit + >>> template.type = 'service' + >>> template.salable = True + >>> template.list_price = Decimal('30') + >>> template.account_category = account_category + >>> template.save() + >>> service, = template.products + +Create payment term:: + + >>> payment_term = create_payment_term() + >>> payment_term.save() + +Create an Inventory:: + + >>> Inventory = Model.get('stock.inventory') + >>> Location = Model.get('stock.location') + >>> storage, = Location.find([ + ... ('code', '=', 'STO'), + ... ]) + >>> inventory = Inventory() + >>> inventory.location = storage + >>> inventory_line = inventory.lines.new(product=product) + >>> inventory_line.quantity = 100.0 + >>> inventory_line.expected_quantity = 0.0 + >>> inventory.click('confirm') + >>> inventory.state + 'done' + +Sale 5 products:: + + >>> sale = Sale() + >>> sale.party = customer + >>> sale.payment_term = payment_term + >>> sale.invoice_method = 'order' + >>> sale_line = SaleLine() + >>> sale.lines.append(sale_line) + >>> sale_line.product = product + >>> sale_line.quantity = 2.0 + >>> sale_line = SaleLine() + >>> sale.lines.append(sale_line) + >>> sale_line.type = 'comment' + >>> sale_line.description = 'Comment' + >>> sale_line = SaleLine() + >>> sale.lines.append(sale_line) + >>> sale_line.product = product + >>> sale_line.quantity = 3.0 + >>> sale.click('quote') + >>> sale.untaxed_amount, sale.tax_amount, sale.total_amount + (Decimal('50.00'), Decimal('5.00'), Decimal('55.00')) + >>> sale.click('confirm') + >>> sale.untaxed_amount, sale.tax_amount, sale.total_amount + (Decimal('50.00'), Decimal('5.00'), Decimal('55.00')) diff --git a/tryton.cfg b/tryton.cfg index 61ef961..8e9135c 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -4,4 +4,5 @@ depends: ir account company + sale xml: