Actualización de las pruebas del modulo
This commit is contained in:
26
sale.py
26
sale.py
@@ -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'
|
||||
@@ -16,11 +15,10 @@ class Sale(metaclass=PoolMeta):
|
||||
('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',
|
||||
@@ -30,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
|
||||
@@ -44,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}")
|
||||
|
||||
Reference in New Issue
Block a user