Compare commits
10 Commits
c38e7fbb32
...
8.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d2bbefdf5 | |||
| c49cff3394 | |||
| 90b7d9e58d | |||
| 85f40d2fca | |||
| 124c9e9028 | |||
| 96753b23a9 | |||
| 642da0a882 | |||
| 64939ee99c | |||
| 166260707b | |||
| 43e32c3209 |
390
.gitignore
vendored
390
.gitignore
vendored
@@ -1,218 +1,218 @@
|
||||
!*.svg # comment out if you don't need vector files
|
||||
!.vscode/*.code-snippets
|
||||
!.vscode/extensions.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# 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
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
# 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
|
||||
# commonly ignored for libraries.
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
# in version control.
|
||||
# install all needed dependencies.
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# Usually these files are written by a python script from a template
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
# -*- 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
|
||||
# Jupyter Notebook
|
||||
# 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
|
||||
# cask packages
|
||||
# directory configuration
|
||||
# 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
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.rar
|
||||
*.rel
|
||||
*.sage.py
|
||||
*$py.class
|
||||
*.bk
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
*.spec
|
||||
*.tar.gz
|
||||
*.vsix
|
||||
*.war
|
||||
*.zip
|
||||
*_archive
|
||||
*_flymake.*
|
||||
*~
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
.\#*
|
||||
.cache
|
||||
.cask/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from 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.*
|
||||
.dir-locals.el
|
||||
.dmypy.json
|
||||
.eggs/
|
||||
.env
|
||||
.history/
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.installed.cfg
|
||||
.ipynb_checkpoints
|
||||
.mtj.tmp/
|
||||
.mypy_cache/
|
||||
.netrwhist
|
||||
.nox/
|
||||
.org-id-locations
|
||||
.pdm.toml
|
||||
.projectile
|
||||
.pybuilder/
|
||||
.pyre/
|
||||
.pytest_cache/
|
||||
.pytype/
|
||||
.ropeproject
|
||||
|
||||
# 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
|
||||
.tox/
|
||||
.venv
|
||||
.venv/
|
||||
.vscode/*
|
||||
.web
|
||||
.webassets-cache
|
||||
|
||||
# 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
|
||||
/auto/
|
||||
/elpa/
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
/network-security.data
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
# cask packages
|
||||
.cask/
|
||||
dist/
|
||||
|
||||
# Flycheck
|
||||
flycheck_*.el
|
||||
|
||||
# server auth directory
|
||||
/server/
|
||||
/site
|
||||
ENV/
|
||||
MANIFEST
|
||||
Session.vim
|
||||
Sessionx.vim
|
||||
|
||||
# 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]
|
||||
[._]*.un~
|
||||
[._]s[a-rt-v][a-z]
|
||||
[._]ss[a-gi-z]
|
||||
[._]sw[a-p]
|
||||
\#*\#
|
||||
__pycache__/
|
||||
__pypackages__/
|
||||
auto-save-list
|
||||
build/
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
cover/
|
||||
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
|
||||
target/
|
||||
tramp
|
||||
var/
|
||||
venv.bak/
|
||||
wheels/
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
18
__init__.py
18
__init__.py
@@ -1,18 +0,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.
|
||||
|
||||
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')
|
||||
|
||||
56
pyproject.toml
Normal file
56
pyproject.toml
Normal file
@@ -0,0 +1,56 @@
|
||||
[build-system]
|
||||
requires = ['hatchling >= 1', 'hatch-tryton']
|
||||
build-backend = 'hatchling.build'
|
||||
|
||||
[project]
|
||||
name = 'trytondo_sale_line_delete_log'
|
||||
dynamic = ['version', 'dependencies', 'optional-dependencies', 'authors', 'readme']
|
||||
requires-python = '>=3.10'
|
||||
maintainers = [
|
||||
{name = "OneCluster", email = "info@onecluster.org"},
|
||||
]
|
||||
description = "Logs deleted sale lines for audit"
|
||||
license = 'GPL-3.0-or-later'
|
||||
license-files = ['LICENSE', 'icons/LICENSE', 'COPYRIGHT']
|
||||
keywords = ["tryton", "sale", "audit", "log"]
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Plugins",
|
||||
"Framework :: Tryton",
|
||||
"Topic :: Office/Business",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
]
|
||||
|
||||
[project.entry-points.'trytond.modules']
|
||||
sale_line_delete_log = 'trytond.modules.sale_line_delete_log'
|
||||
|
||||
[project.urls]
|
||||
homepage = "https://www.onecluster.org/"
|
||||
documentation = "https://docs.tryton.org/"
|
||||
forum = "https://www.tryton.org/forum"
|
||||
issues = "https://bugs.tryton.org/tryton"
|
||||
funding = "https://www.tryton.org/donate"
|
||||
|
||||
[tool.hatch.build]
|
||||
include = [
|
||||
'**/tryton.cfg',
|
||||
'**/*.py',
|
||||
'**/*.xml',
|
||||
'view/**/*.xml',
|
||||
'locale/**/*.po',
|
||||
'**/*.fodt',
|
||||
'icons/**/*.svg',
|
||||
'tests/**/*.rst',
|
||||
'tests/**/*.json',
|
||||
]
|
||||
exclude = ['doc']
|
||||
|
||||
[tool.hatch.build.targets.wheel.sources]
|
||||
"" = "trytond/modules/sale_line_delete_log"
|
||||
|
||||
[tool.hatch.metadata.hooks.tryton]
|
||||
copyright = 'COPYRIGHT'
|
||||
readme = 'README.rst'
|
||||
|
||||
[tool.hatch.metadata.hooks.tryton.tryton-optional-dependencies]
|
||||
test = ['proteus']
|
||||
7
sale.py
7
sale.py
@@ -17,20 +17,19 @@ class SaleLine(metaclass=PoolMeta):
|
||||
__name__ = 'sale.line'
|
||||
|
||||
@classmethod
|
||||
def delete(cls, lines):
|
||||
def _create_sale_line_deleted_log(cls, line):
|
||||
pool = Pool()
|
||||
SaleLineDeleted = pool.get('sale.line_deleted')
|
||||
for line in lines:
|
||||
|
||||
SaleLineDeleted.create([{
|
||||
'sale': line.sale,
|
||||
'sale_date': line.sale_date,
|
||||
'quantity': line.quantity,
|
||||
'unit': line.unit,
|
||||
'product': line.product,
|
||||
'user': Transaction().user
|
||||
}])
|
||||
|
||||
super(SaleLine, cls).delete(lines)
|
||||
|
||||
|
||||
class SaleLineDeleted(ModelSQL, ModelView):
|
||||
'Register lines deleted in sale'
|
||||
|
||||
133
setup.py
133
setup.py
@@ -1,133 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
from configparser import ConfigParser
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
|
||||
def read(fname):
|
||||
content = io.open(
|
||||
os.path.join(os.path.dirname(__file__), fname),
|
||||
'r', encoding='utf-8').read()
|
||||
content = re.sub(
|
||||
r'(?m)^\.\. toctree::\r?\n((^$|^\s.*$)\r?\n)*', '', content)
|
||||
return content
|
||||
|
||||
|
||||
def get_require_version(name):
|
||||
require = '%s >= %s.%s, < %s.%s'
|
||||
require %= (name, major_version, minor_version,
|
||||
major_version, minor_version + 1)
|
||||
return require
|
||||
|
||||
|
||||
config = ConfigParser()
|
||||
config.read_file(open(os.path.join(os.path.dirname(__file__), 'tryton.cfg')))
|
||||
info = dict(config.items('tryton'))
|
||||
for key in ('depends', 'extras_depend', 'xml'):
|
||||
if key in info:
|
||||
info[key] = info[key].strip().splitlines()
|
||||
version = info.get('version', '0.0.1')
|
||||
major_version, minor_version, _ = version.split('.', 2)
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
name = 'trytondo_sale_line_delete_log'
|
||||
|
||||
if minor_version % 2:
|
||||
download_url = ''
|
||||
else:
|
||||
download_url = 'http://downloads.tryton.org/%s.%s/' % (
|
||||
major_version, minor_version)
|
||||
|
||||
requires = []
|
||||
for dep in info.get('depends', []):
|
||||
if not re.match(r'(ir|res)(\W|$)', dep):
|
||||
requires.append(get_require_version('trytond_%s' % dep))
|
||||
requires.append(get_require_version('trytond'))
|
||||
|
||||
tests_require = [get_require_version('proteus')]
|
||||
|
||||
setup(name=name,
|
||||
version=version,
|
||||
description='',
|
||||
long_description=read('README.rst'),
|
||||
author='Tryton',
|
||||
author_email='foundation@tryton.org',
|
||||
url='http://www.tryton.org/',
|
||||
download_url=download_url,
|
||||
project_urls={
|
||||
"Bug Tracker": 'https://bugs.tryton.org/',
|
||||
"Documentation":
|
||||
'https://docs.tryton.org/latest/modules-sale-line-delete-log',
|
||||
"Forum": 'https://www.tryton.org/forum',
|
||||
"Source Code": 'https://code.tryton.org/tryton',
|
||||
},
|
||||
keywords='',
|
||||
package_dir={'trytond.modules.sale_line_delete_log': '.'},
|
||||
packages=(
|
||||
['trytond.modules.sale_line_delete_log']
|
||||
+ ['trytond.modules.sale_line_delete_log.%s' % p
|
||||
for p in find_packages()]
|
||||
),
|
||||
package_data={
|
||||
'trytond.modules.sale_line_delete_log': (info.get('xml', [])
|
||||
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
|
||||
'icons/*.svg', 'tests/*.rst', 'tests/*.json']),
|
||||
},
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Environment :: Plugins',
|
||||
'Framework :: Tryton',
|
||||
'Intended Audience :: Developers',
|
||||
'Intended Audience :: Financial and Insurance Industry',
|
||||
'Intended Audience :: Legal Industry',
|
||||
'License :: OSI Approved :: '
|
||||
'GNU General Public License v3 or later (GPLv3+)',
|
||||
'Natural Language :: Bulgarian',
|
||||
'Natural Language :: Catalan',
|
||||
'Natural Language :: Chinese (Simplified)',
|
||||
'Natural Language :: Czech',
|
||||
'Natural Language :: Dutch',
|
||||
'Natural Language :: English',
|
||||
'Natural Language :: Finnish',
|
||||
'Natural Language :: French',
|
||||
'Natural Language :: German',
|
||||
'Natural Language :: Hungarian',
|
||||
'Natural Language :: Indonesian',
|
||||
'Natural Language :: Italian',
|
||||
'Natural Language :: Persian',
|
||||
'Natural Language :: Polish',
|
||||
'Natural Language :: Portuguese (Brazilian)',
|
||||
'Natural Language :: Romanian',
|
||||
'Natural Language :: Russian',
|
||||
'Natural Language :: Slovenian',
|
||||
'Natural Language :: Spanish',
|
||||
'Natural Language :: Turkish',
|
||||
'Natural Language :: Ukrainian',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
'Programming Language :: Python :: 3.10',
|
||||
'Programming Language :: Python :: 3.11',
|
||||
'Programming Language :: Python :: 3.12',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
'Topic :: Office/Business',
|
||||
],
|
||||
license='GPL-3',
|
||||
python_requires='>=3.8',
|
||||
install_requires=requires,
|
||||
extras_require={
|
||||
'test': tests_require,
|
||||
},
|
||||
zip_safe=False,
|
||||
entry_points="""
|
||||
[trytond.modules]
|
||||
sale_line_delete_log = trytond.modules.sale_line_delete_log
|
||||
""", # noqa: E501
|
||||
)
|
||||
Binary file not shown.
Binary file not shown.
@@ -175,11 +175,4 @@ Delete a sale line::
|
||||
>>> 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"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[tryton]
|
||||
version=6.8.0
|
||||
version=8.0.0
|
||||
depends:
|
||||
ir
|
||||
account
|
||||
@@ -7,3 +7,9 @@ depends:
|
||||
sale
|
||||
xml:
|
||||
sale.xml
|
||||
|
||||
[register]
|
||||
model:
|
||||
sale.Sale
|
||||
sale.SaleLine
|
||||
sale.SaleLineDeleted
|
||||
|
||||
Reference in New Issue
Block a user