10 Commits
main ... 7.6

Author SHA1 Message Date
1f79f62d6b Update: tryton 7.6 2025-06-06 15:51:56 -05:00
root
554bf84e53 Actualización de las pruebas del modulo 2024-01-03 16:20:28 +00:00
90f641766a fix: Se incrementa version a 6.8.0 2023-11-12 10:11:27 -05:00
de0cf3f450 fix: Se quita cuenta analítica en factura como requerida 2023-07-30 21:32:28 -05:00
464e261493 clean home 2023-07-25 08:06:01 -05:00
733c8861fe update READMIN 2023-07-01 01:45:00 -05:00
43648e0c5c add operation analytic to invoice 2023-07-01 01:41:46 -05:00
f8d3c1b03d add operation analytic to invoice 2023-07-01 01:40:02 -05:00
1285df0ffd correction to name module in __init__ 2023-06-26 14:29:38 -05:00
5c38127f37 add traslations 2023-06-08 15:59:20 -05:00
14 changed files with 150 additions and 87 deletions

View File

@@ -1,37 +0,0 @@
# CONTRIBUIR
### requerimientos tecnicos
* python >= 3.9
* docker >= 20
* docker-compose >= 2
* pre-commit >= 2
* git >= 2.30
### consideraciones
* evito trabajo innecesario
* evito generalizar, primero hago pruebas y luego elimino duplicidad
* evito redundancia, si lo puedo automatizar lo automatizo
* evito usar `git add .`
* a todo momento hago expresivo lo escrito, renombro, muevo o elimino
* en todo momento debo poder ejecutar las pruebas
* en todo momento debo poder el programa
* en todo momento especulo, me ilustro y aprendo
### convencion commit
ante cada commit el mensaje se clasifica en:
* **feat(\<COMPONENTE\>)** una nueva funcionalidad accesible al usuario o sistema
* **fix(\<COMPONENTE\>)** correcion de una funcionalidad ya entregada
* **chore(\<COMPONENTE\>)** otros cambios que no impactan directamente al usuario, ejemplo renombramiento de archivo,clases,metodos,variables,carpetas,scripts, documentacion, recursos digitales, etc..
`COMPONENTE` nombre del directorio
ejemplos:
`git commit -m 'feat(<COMPONENTE>): venta de equipos opticos`
`git commit -m 'fix(<COMPONENTE>): se adiciona boton faltante`
`git commit -m 'chore(<COMPONENTE>): cambio de color en columna Producto`

View File

@@ -0,0 +1,7 @@
Analytic Operations Module
=========================
The *Analytic Operations Module* adds the concept of analytic account general
in invoice, purchase, sale. This allows added the account analytic to the lines of
operation more fast.

View File

@@ -2,7 +2,7 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
from . import purchase, sale
from . import invoice, purchase, sale
__all__ = ['register']
@@ -13,8 +13,10 @@ def register():
purchase.PurchaseLine,
sale.Sale,
sale.SaleLine,
module='analytic_operation', type_='model')
invoice.Invoice,
invoice.InvoiceLine,
module='analytic_operations', type_='model')
Pool.register(
module='analytic_operation', type_='wizard')
module='analytic_operations', type_='wizard')
Pool.register(
module='analytic_operation', type_='report')
module='analytic_operations', type_='report')

View File

@@ -1,6 +1,10 @@
#########################
Analytic Operation Module
#########################
######################
Analytic Operations Module
######################
The *Analytic Operations Module* adds the concept of analytic account general
in invoice, purchase, sale. This allows added the account analytic to the lines of
operation more fast.
.. toctree::
:maxdepth: 2

42
invoice.py Normal file
View File

@@ -0,0 +1,42 @@
# 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 PoolMeta
from trytond.model import fields
from trytond.pyson import Eval
from trytond.model.exceptions import ValidationError
class Invoice(metaclass=PoolMeta):
'Account Invoice'
__name__ = 'account.invoice'
_states = {
'readonly': Eval('state') != 'draft',
}
account_analytic = fields.Many2One(
'analytic_account.account', 'Analytic Account',
domain=[('type', '=', 'normal')],
states=_states)
class InvoiceLine(metaclass=PoolMeta):
'Invoice Line'
__name__ = 'account.invoice.line'
@fields.depends(
'product', 'unit', '_parent_invoice.type', 'analytic_accounts',
'_parent_invoice.party', 'party', 'invoice', 'invoice_type',
'_parent_invoice.account_analytic', '_parent_invoice.invoice_date',
'_parent_invoice.accounting_date', 'company',
methods=['_get_tax_rule_pattern'])
def on_change_product(self):
super(InvoiceLine, self).on_change_product()
self.analytic_accounts = tuple()
try:
if self.invoice and self.invoice.account_analytic:
self.analytic_accounts += (
{'root': self.invoice.account_analytic.root,
'account': self.invoice.account_analytic},)
except Exception as e:
raise ValidationError(f"Se produjo un error: {e}")

11
invoice.xml Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!--This file file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="invoice_view_form">
<field name="model">account.invoice</field>
<field name="inherit" ref="account_invoice.invoice_view_form"/>
<field name="name">invoice_form</field>
</record>
</data>
</tryton>

15
locale/es.po Normal file
View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:account.invoice,account_analytic:"
msgid "Analytic Account"
msgstr "Cuenta Analítica"
msgctxt "field:purchase.purchase,account_analytic:"
msgid "Analytic Account"
msgstr "Cuenta Analítica"
msgctxt "field:sale.sale,account_analytic:"
msgid "Analytic Account"
msgstr "Cuenta Analítica"

View File

@@ -1,29 +1,36 @@
# 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, PoolMeta
from trytond.model import ModelView, ModelSQL, fields
from trytond.pool import PoolMeta
from trytond.model import fields
from trytond.pyson import Eval
from trytond.model.exceptions import ValidationError
from trytond.exceptions import UserError
class Purchase(metaclass=PoolMeta):
'Purchase Analytic Operation'
__name__ = 'purchase.purchase'
account_analytic = fields.Many2One('analytic_account.account',
'Analytic Account', required=True,
domain=[
('type', '=', 'normal'),
])
_states = {
'readonly': Eval('state') != 'draft',
}
account_analytic = fields.Many2One(
'analytic_account.account', 'Analytic Account', required=True,
domain=[('type', '=', 'normal')],
states=_states)
class PurchaseLine(metaclass=PoolMeta):
'Purchase Line Analytic Operation'
__name__ = 'purchase.line'
__name__ = 'purchase.line'
@fields.depends('product', 'unit', 'purchase',
@fields.depends(
'product', 'unit', 'purchase',
'_parent_purchase.party', '_parent_purchase.invoice_party',
'_parent_purchase.account_analytic', 'product_supplier',
'analytic_accounts', methods=['compute_taxes', 'compute_unit_price',
'_get_product_supplier_pattern'])
'analytic_accounts',
methods=['compute_taxes', 'compute_unit_price',
'_get_product_supplier_pattern'])
def on_change_product(self):
if not self.product:
return
@@ -41,7 +48,7 @@ class PurchaseLine(metaclass=PoolMeta):
self.unit = self.product.purchase_uom
product_suppliers = list(self.product.product_suppliers_used(
**self._get_product_supplier_pattern()))
**self._get_product_supplier_pattern()))
if len(product_suppliers) == 1:
self.product_supplier, = product_suppliers
elif (self.product_supplier
@@ -55,7 +62,8 @@ class PurchaseLine(metaclass=PoolMeta):
self.analytic_accounts = tuple()
try:
self.analytic_accounts += ({'root': self.purchase.account_analytic.root,
'account': self.purchase.account_analytic},)
except:
pass
self.analytic_accounts += (
{'root': self.purchase.account_analytic.root,
'account': self.purchase.account_analytic},)
except Exception as e:
raise ValidationError(f"Se produjo un error: {e}")

27
sale.py
View File

@@ -1,10 +1,9 @@
# 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, PoolMeta
from trytond.model import ModelView, ModelSQL, fields
from trytond.pyson import Eval
from trytond.pool import PoolMeta
from trytond.model import fields
from trytond.model.exceptions import ValidationError
from trytond.exceptions import UserError
class Sale(metaclass=PoolMeta):
'Sale Analytic Operation'
@@ -15,11 +14,11 @@ class Sale(metaclass=PoolMeta):
domain=[
('type', '=', 'normal'),
])
class SaleLine(metaclass=PoolMeta):
'Sale Line Analytic Operation'
__name__ = 'sale.line'
__name__ = 'sale.line'
@fields.depends('product', 'unit', 'sale',
'_parent_sale.party', '_parent_sale.invoice_party',
@@ -29,7 +28,7 @@ class SaleLine(metaclass=PoolMeta):
def on_change_product(self):
if not self.product:
return
party = None
if self.sale:
party = self.sale.invoice_party or self.sale.party
@@ -43,13 +42,13 @@ class SaleLine(metaclass=PoolMeta):
self.unit_price = self.compute_unit_price()
self.type = 'line'
self.amount = self.on_change_with_amount()
self.analytic_accounts = tuple()
try:
self.analytic_accounts += ({'root': self.sale.account_analytic.root,
'account': self.sale.account_analytic},)
except:
pass
self.analytic_accounts += (
{'root': self.sale.account_analytic.root,
'account': self.sale.account_analytic},)
except Exception as e:
raise ValidationError(f"Se produjo un error: {e}")

View File

@@ -39,7 +39,7 @@ 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 = 'trytond_analytic_operation'
name = 'trytond_analytic_operations'
download_url = 'http://downloads.tryton.org/%s.%s/' % (
major_version, minor_version)
@@ -85,19 +85,20 @@ setup(name=name,
download_url=download_url,
project_urls={
"Bug Tracker": 'https://bugs.tryton.org/',
"Documentation": 'https://docs.tryton.org/projects/modules-analytic-operation',
"Documentation":
'https://docs.tryton.org/projects/modules-analytic-operation',
"Forum": 'https://www.tryton.org/forum',
"Source Code": 'https://hg.tryton.org/modules/analytic_operation',
"Source Code": 'https://hg.tryton.org/modules/analytic_operations',
},
keywords='analitic, invoice, purchase, sale',
package_dir={'trytond.modules.analytic_operation': '.'},
package_dir={'trytond.modules.analytic_operations': '.'},
packages=(
['trytond.modules.analytic_operation']
+ ['trytond.modules.analytic_operation.%s' % p
['trytond.modules.analytic_operations']
+ ['trytond.modules.analytic_operations.%s' % p
for p in find_packages()]
),
package_data={
'trytond.modules.analytic_operation': (info.get('xml', [])
'trytond.modules.analytic_operations': (info.get('xml', [])
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
'icons/*.svg', 'tests/*.rst']),
},
@@ -150,6 +151,6 @@ setup(name=name,
zip_safe=False,
entry_points="""
[trytond.modules]
analytic_operation = trytond.modules.analytic_operation
analytic_operations = trytond.modules.analytic_operations
""", # noqa: E501
)

View File

@@ -5,7 +5,7 @@ from trytond.tests.test_tryton import ModuleTestCase
class AnalyticOperationTestCase(ModuleTestCase):
"Test Analytic Operation module"
module = 'analytic_operation'
module = 'analytic_operations'
del ModuleTestCase

View File

@@ -4,8 +4,8 @@ envlist = {py37,py38,py39,py310}-{sqlite,postgresql}
[testenv]
extras = test
commands =
coverage run --include=./**/analytic_operation/* -m unittest discover -s tests
coverage report --include=./**/analytic_operation/* --omit=*/tests/*
coverage run --include=./**//* -m unittest discover -s tests
coverage report --include=./**/analytic_operations/* --omit=*/tests/*
deps =
coverage
postgresql: psycopg2 >= 2.7.0

View File

@@ -1,5 +1,5 @@
[tryton]
version=6.4
version=7.6.0
depends:
ir
purchase
@@ -8,3 +8,4 @@ depends:
xml:
purchase.xml
sale.xml
invoice.xml

10
view/invoice_form.xml Normal file
View File

@@ -0,0 +1,10 @@
<?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="/form/field[@name='reference']" position="after">
<label name="account_analytic"/>
<field name="account_analytic" xexpand="1"/>
</xpath>
</data>