Se corrieron las pruebas de estilo y de tryton

This commit is contained in:
root 2024-01-04 21:56:49 +00:00
parent 80c13f3c98
commit b6250456f5
2 changed files with 51 additions and 35 deletions

View File

@ -1,28 +1,39 @@
# 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.modules.currency.fields import Monetary
from trytond.exceptions import UserError
from decimal import Decimal
from trytond.model.exceptions import ValidationError
class InvoiceLine(metaclass=PoolMeta):
'Invoice Line Extras'
__name__ = 'account.invoice.line'
tax_amount = fields.Function(Monetary("Tax", currency='currency', digits='currency'),
tax_amount = fields.Function(Monetary("Tax",
currency='currency',
digits='currency'),
'get_amount_taxes')
tax_unit = fields.Function(Monetary("Unit Tax", currency='currency', digits='currency'),
tax_unit = fields.Function(Monetary("Unit Tax",
currency='currency',
digits='currency'),
'get_unit_taxes')
total_with_taxes = fields.Function(Monetary("Total With Taxes", currency='currency', digits='currency'),
total_with_taxes = fields.Function(Monetary("Total With Taxes",
currency='currency',
digits='currency'),
'get_total_with_taxes')
unit_with_tax = fields.Function(Monetary("Unit With Tax", currency='currency', digits='currency'),
unit_with_tax = fields.Function(Monetary("Unit With Tax",
currency='currency',
digits='currency'),
'get_unit_with_tax')
tax_extra_unit = Monetary("Tax Extra Unit", currency='currency', digits='currency')
tax_extra_unit = Monetary(
"Tax Extra Unit", currency='currency', digits='currency')
total_tax_extra = fields.Function(Monetary("Total Tax Extra", currency='currency', digits='currency'),
total_tax_extra = fields.Function(Monetary(
"Total Tax Extra",
currency='currency',
digits='currency'),
'get_total_tax_extra')
@fields.depends('type', 'quantity', 'unit_price', 'unit', 'invoice',
@ -39,7 +50,6 @@ class InvoiceLine(metaclass=PoolMeta):
return tax_amount
return Decimal('0.0')
@fields.depends('type', 'quantity', 'unit_price', 'unit', 'invoice',
'_parent_invoice.currency', 'taxes', 'amount')
def on_change_with_tax_unit(self):
@ -60,21 +70,24 @@ class InvoiceLine(metaclass=PoolMeta):
try:
total_with_taxes = self.amount + self.tax_amount
return total_with_taxes
except:
pass
except Exception as e:
raise ValidationError(f"Se produjo un error {e}.")
@fields.depends('type', 'quantity', 'unit_price', 'unit', 'invoice',
'_parent_invoice.currency', 'taxes', 'amount')
@fields.depends('type', 'quantity',
'unit_price', 'unit',
'invoice', '_parent_invoice.currency',
'taxes', 'amount')
def on_change_with_unit_with_tax(self):
try:
unit_with_tax = self.unit_price + self.tax_unit
return unit_with_tax
except:
pass
except Exception as e:
raise ValidationError(f"Se produjo un error {e}.")
@fields.depends('type', 'quantity', 'tax_extra_unit', 'unit_price', 'unit', 'invoice',
'_parent_invoice.currency', 'taxes', 'amount')
@fields.depends('type', 'quantity', 'tax_extra_unit',
'unit_price', 'unit', 'invoice',
'_parent_invoice.currency',
'taxes', 'amount')
def on_change_with_total_tax_extra(self):
if self.type == 'line':
currency = self.invoice.currency if self.invoice else None
@ -86,13 +99,15 @@ class InvoiceLine(metaclass=PoolMeta):
return Decimal('0.0')
@fields.depends('product', 'unit', '_parent_invoice.type',
'_parent_invoice.party', 'party', 'invoice', 'invoice_type',
'_parent_invoice.invoice_date', '_parent_invoice.accounting_date',
'_parent_invoice.party',
'party', 'invoice', 'invoice_type',
'_parent_invoice.invoice_date',
'_parent_invoice.accounting_date',
'company', methods=['_get_tax_rule_pattern'])
def on_change_product(self):
self.tax_amount = self.on_change_with_tax_amount()
self.total_with_taxes = self.on_change_with_total_with_taxes()
super(Line, self).on_change_product()
super(InvoiceLine, self).on_change_product()
def get_amount_taxes(self, name):
if self.type == 'line':

View File

@ -85,7 +85,8 @@ setup(name=name,
download_url=download_url,
project_urls={
"Bug Tracker": 'https://bugs.tryton.org/',
"Documentation": 'https://docs.tryton.org/projects/modules-purchase-line-extras',
"Documentation":
'https://docs.tryton.org/projects/modules-purchase-line-extras',
"Forum": 'https://www.tryton.org/forum',
"Source Code": 'https://hg.tryton.org/modules/purchase_line_extras',
},