Files
tryton/invoice.py
T

45 lines
1.5 KiB
Python
Raw Normal View History

2014-12-02 12:54:42 +01:00
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
2010-01-20 10:58:13 +01:00
from trytond.pyson import Eval
2010-08-19 22:03:14 +02:00
from trytond.transaction import Transaction
2012-09-24 22:17:34 +02:00
from trytond.pool import PoolMeta
__all__ = ['Invoice', 'InvoiceLine']
2018-06-26 19:11:42 +02:00
class Invoice(metaclass=PoolMeta):
2012-09-24 22:17:34 +02:00
__name__ = 'account.invoice'
2012-09-24 22:17:34 +02:00
@classmethod
def __setup__(cls):
super(Invoice, cls).__setup__()
2010-01-20 10:58:13 +01:00
add_remove = [
('invoice_type', '=', Eval('type')),
('party', '=', Eval('party')),
('currency', '=', Eval('currency')),
('company', '=', Eval('company')),
2012-03-27 10:43:09 +02:00
('invoice', '=', None),
2010-01-20 10:58:13 +01:00
]
2012-12-16 23:41:43 +01:00
add_remove_depends = set(['type', 'party', 'currency', 'company'])
2010-01-20 10:58:13 +01:00
2012-09-24 22:17:34 +02:00
if not cls.lines.add_remove:
cls.lines.add_remove = add_remove
else:
2012-09-24 22:17:34 +02:00
cls.lines.add_remove = [
2010-01-20 10:58:13 +01:00
add_remove,
2012-09-24 22:17:34 +02:00
cls.lines.add_remove,
]
2012-12-16 23:41:43 +01:00
cls.lines.depends = list(set(cls.lines.depends) | add_remove_depends)
2009-02-28 16:57:39 +01:00
2018-06-26 19:11:42 +02:00
class InvoiceLine(metaclass=PoolMeta):
2012-09-24 22:17:34 +02:00
__name__ = 'account.invoice.line'
2012-09-24 22:17:34 +02:00
@classmethod
def _view_look_dom_arch(cls, tree, type, field_children=None):
2010-08-19 22:03:14 +02:00
if type == 'form' and Transaction().context.get('standalone'):
tree_root = tree.getroottree().getroot()
if tree_root.get('cursor') == 'product':
tree_root.set('cursor', 'party')
2012-09-24 22:17:34 +02:00
return super(InvoiceLine, cls)._view_look_dom_arch(tree, type,
2011-04-04 19:45:55 +02:00
field_children=field_children)