Compare commits

..

3 Commits

Author SHA1 Message Date
Mongar28
dca30aa932 Feat:Se agrega vista a 'sale_form' 2 2024-08-15 11:53:49 -05:00
Mongar28
a97bf69aca Feat:Se agrega vista a 'sale_form 2024-08-15 11:38:20 -05:00
Mongar28
77c5fd858e Feat:Se agrega vista a 'sale_form 2024-08-15 11:03:50 -05:00
20 changed files with 514 additions and 216 deletions

407
.gitignore vendored
View File

@ -1,229 +1,218 @@
# ---> Python !*.svg # comment out if you don't need vector files
# Byte-compiled / optimized / DLL files !.vscode/*.code-snippets
__pycache__/ !.vscode/extensions.json
*.py[cod] !.vscode/launch.json
*$py.class !.vscode/settings.json
*.bk !.vscode/tasks.json
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
/.vscode # For a library or package, you might want to ignore these files since the code is
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# C extensions # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
*.so # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# Distribution / packaging # commonly ignored for libraries.
.Python # having no cross-platform support, pipenv may install dependencies that don't work, or not
build/ # https://pdm.fming.dev/#use-with-ide
develop-eggs/ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
dist/ # in version control.
downloads/ # install all needed dependencies.
eggs/ # intended to run in multiple environments; otherwise, check them in:
.eggs/ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
lib/ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
lib64/ # Usually these files are written by a python script from a template
parts/ # and can be added to the global gitignore or merged into this file. For a more nuclear
sdist/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
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. # before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest # option (not recommended) you can uncomment the following to ignore the entire idea folder.
*.spec # -*- mode: gitignore; -*-
# ---> Emacs
# ---> Java
# ---> Python
# ---> Vim
# ---> VisualStudioCode
# .python-version
# AUCTeX auto folder
# Auto-generated tag files
# BlueJ files
# Built Visual Studio Code Extensions
# Byte-compiled / optimized / DLL files
# C extensions
# Celery stuff
# Compiled class file
# Cython debug symbols
# Distribution / packaging
# Django stuff:
# Environments
# Flask stuff:
# Flycheck
IPython
# Installer logs # Installer logs
pip-log.txt # Jupyter Notebook
pip-delete-this-directory.txt # Local History for Visual Studio Code
# Log file
# Mobile Tools for Java (J2ME)
# Org-mode
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
# Package Files #
# Persistent undo
# PyBuilder
# PyCharm
# PyInstaller
# Pyre type checker
# Rope project settings
# SageMath parsed files
# Scrapy stuff:
# Session
# Sphinx documentation
# Spyder project settings
# Swap
# Temporary
# Translations
# Unit test / coverage reports # Unit test / coverage reports
htmlcov/ # cask packages
.tox/ # directory configuration
.nox/ # elpa packages
# eshell files
# flymake-mode
# mkdocs documentation
# mypy
# network security
# pdm
# pipenv
# poetry
# projectiles files
pyenv
# pytype static type analyzer
# reftex files
# server auth directory
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
#.idea/
#Pipfile.lock
#pdm.lock
#poetry.lock
*$py.class
*.class
*.cover
*.ctxt
*.db
*.ear
*.egg
*.egg-info/
*.elc
*.jar
*.log
*.manifest
*.mo
*.nar
*.pot
*.py,cover
*.py[cod]
*.rar
*.rel
*.sage.py
*.so
*.spec
*.tar.gz
*.vsix
*.war
*.zip
*_archive
*_flymake.*
*~
.Python
.\#*
.cache
.cask/
.coverage .coverage
.coverage.* .coverage.*
.cache .dir-locals.el
nosetests.xml .dmypy.json
coverage.xml .eggs/
*.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 .env
.venv .history/
env/ .hypothesis/
venv/ .installed.cfg
ENV/ .ipynb_checkpoints
env.bak/ .mtj.tmp/
venv.bak/ .mypy_cache/
.netrwhist
# Spyder project settings .nox/
.org-id-locations
.pdm.toml
.projectile
.pybuilder/
.pyre/
.pytest_cache/
.pytype/
.ropeproject
.scrapy
.spyderproject .spyderproject
.spyproject .spyproject
.tox/
# Rope project settings .venv
.ropeproject .venv/
.vscode/*
# mkdocs documentation .web
/site .webassets-cache
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# ---> Emacs
# -*- mode: gitignore; -*-
*~
.~*
*#
\#*\#
/.emacs.desktop /.emacs.desktop
/.emacs.desktop.lock /.emacs.desktop.lock
*.elc /auto/
auto-save-list /elpa/
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history /eshell/history
/eshell/lastdir /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 /network-security.data
/server/
/site
# ---> Vim ENV/
# Swap MANIFEST
Session.vim
Sessionx.vim
[._]*.s[a-v][a-z] [._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p] [._]*.sw[a-p]
[._]*.un~
[._]s[a-rt-v][a-z] [._]s[a-rt-v][a-z]
[._]ss[a-gi-z] [._]ss[a-gi-z]
[._]sw[a-p] [._]sw[a-p]
\#*\#
# Session __pycache__/
Session.vim __pypackages__/
Sessionx.vim auto-save-list
build/
# Temporary celerybeat-schedule
.netrwhist celerybeat.pid
*~ cover/
# Auto-generated tag files coverage.xml
cython_debug/
db.sqlite3
db.sqlite3-journal
develop-eggs/
dist/
dmypy.json
docs/_build/
downloads/
eggs/
env.bak/
env/
flycheck_*.el
hs_err_pid*
htmlcov/
instance/
ipython_config.py
lib/
lib64/
local_settings.py
nosetests.xml
parts/
pip-delete-this-directory.txt
pip-log.txt
profile_default/
replay_pid*
sdist/
share/python-wheels/
tags tags
# Persistent undo target/
[._]*.un~ tramp
var/
# ---> VirtualEnv venv.bak/
# Virtualenv wheels/
# 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

Binary file not shown.

View File

@ -0,0 +1,18 @@
# 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.pool import Pool
from . import sale
__all__ = ['register']
def register():
Pool.register(
sale.Sale,
sale.SaleLine,
sale.SaleLineDeleted,
module='sale_line_delete_log', type_='model')
Pool.register(
module='sale_line_delete_log', type_='wizard')
Pool.register(
module='sale_line_delete_log', type_='report')

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,185 @@
=============================
Sale Line Delete Log Scenario
=============================
Imports::
>>> 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
>>> from trytond.modules.sale_line_delete_log.sale import SaleLineDeleted
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()
Set employee::
>>> 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')
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.save()
>>> len(sale.lines)
3
>>> sale.untaxed_amount, sale.tax_amount, sale.total_amount
(Decimal('50.00'), Decimal('5.00'), Decimal('55.00'))
Delete a sale line::
>>> sale.lines[0].delete()
>>> sale.save()
>>> len(sale.lines)
2
>>> sale.reload()
>>> sale.delete_lines[0]
proteus.Model.get('sale.line_deleted')(1)
>>> assert isinstance(sale.delete_lines[0], Model.get('sale.line_deleted')), "it's not instance SaleLineDeleted"

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 SaleLineDeleteLogTestCase(ModuleTestCase):
"Test Sale Line Delete Log module"
module = 'sale_line_delete_log'
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)

View File

@ -1,6 +1,5 @@
from trytond.pool import PoolMeta, Pool from trytond.pool import PoolMeta, Pool
from trytond.model import fields, ModelSQL, ModelView from trytond.model import fields, ModelSQL, ModelView
from trytond.pyson import Eval
from trytond.transaction import Transaction from trytond.transaction import Transaction
@ -12,7 +11,7 @@ class Sale(metaclass=PoolMeta):
'sale', 'sale',
"Delete lines", "Delete lines",
states={ states={
'readonly': Eval('state') != 'draft' 'readonly': True
} }
) )

View File

@ -1,5 +1,11 @@
<tryton> <tryton>
<data> <data>
<record model="ir.ui.view" id="sale_view_form">
<field name="model">sale.sale</field>
<field name="inherit" ref="sale.sale_view_form"/>
<field name="name">sale_form</field>
</record>
<record model="ir.ui.view" id="sale_line_deleted_view_form"> <record model="ir.ui.view" id="sale_line_deleted_view_form">
<field name="model">sale.line_deleted</field> <field name="model">sale.line_deleted</field>
<field name="type">form</field> <field name="type">form</field>

View File

@ -0,0 +1,59 @@
Metadata-Version: 2.1
Name: trytondo-sale-line-delete-log
Version: 6.8.0
Home-page: http://www.tryton.org/
Download-URL: http://downloads.tryton.org/6.8/
Author: Tryton
Author-email: foundation@tryton.org
License: GPL-3
Project-URL: Bug Tracker, https://bugs.tryton.org/
Project-URL: Documentation, https://docs.tryton.org/latest/modules-sale-line-delete-log
Project-URL: Forum, https://www.tryton.org/forum
Project-URL: Source Code, https://code.tryton.org/tryton
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Legal Industry
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Natural Language :: Bulgarian
Classifier: Natural Language :: Catalan
Classifier: Natural Language :: Chinese (Simplified)
Classifier: Natural Language :: Czech
Classifier: Natural Language :: Dutch
Classifier: Natural Language :: English
Classifier: Natural Language :: Finnish
Classifier: Natural Language :: French
Classifier: Natural Language :: German
Classifier: Natural Language :: Hungarian
Classifier: Natural Language :: Indonesian
Classifier: Natural Language :: Italian
Classifier: Natural Language :: Persian
Classifier: Natural Language :: Polish
Classifier: Natural Language :: Portuguese (Brazilian)
Classifier: Natural Language :: Romanian
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Natural Language :: Turkish
Classifier: Natural Language :: Ukrainian
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Office/Business
Requires-Python: >=3.8
Provides-Extra: test
License-File: LICENSE
###########################
Sale Line Delete Log Module
###########################
.. to remove, see https://www.tryton.org/develop/guidelines/documentation#index.rst

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,2 @@
[trytond.modules]
sale_line_delete_log = trytond.modules.sale_line_delete_log

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,7 @@
trytond_account<6.9,>=6.8
trytond_company<6.9,>=6.8
trytond_sale<6.9,>=6.8
trytond<6.9,>=6.8
[test]
proteus<6.9,>=6.8

View File

@ -0,0 +1 @@
trytond

8
view/sale_form.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="//field[@name='lines']" position="after">
<field name="delete_lines" colspan="4"/>
</xpath>
</data>

View File

@ -3,10 +3,10 @@
this repository contains the full copyright notices and license terms. --> this repository contains the full copyright notices and license terms. -->
<tree> <tree>
<field name="sale"/> <field name="user"/>
<field name="sale_date"/>
<field name="product"/>
<field name="quantity"/> <field name="quantity"/>
<field name="unit"/> <field name="unit"/>
<field name="product"/> <field name="sale"/>
<field name="sale_date"/>
<field name="user"/>
</tree> </tree>