Feat: Se añande atributo delete_lines

This commit is contained in:
Mongar28 2024-08-14 10:01:41 -05:00
parent 96093f16e5
commit 1eb41e1b92
5 changed files with 20 additions and 3 deletions

View File

@ -2,12 +2,13 @@
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
from trytond.pool import Pool from trytond.pool import Pool
from . import sale
__all__ = ['register'] __all__ = ['register']
def register(): def register():
Pool.register( Pool.register(
sale.Sale,
module='sale_line_delete_log', type_='model') module='sale_line_delete_log', type_='model')
Pool.register( Pool.register(
module='sale_line_delete_log', type_='wizard') module='sale_line_delete_log', type_='wizard')

Binary file not shown.

16
sale.py Normal file
View File

@ -0,0 +1,16 @@
from trytond.pool import PoolMeta
from trytond.model import fields
from trytond.pyson import Eval
class Sale(metaclass=PoolMeta):
__name__ = 'sale.sale'
delete_lines = fields.One2Many(
'sale.line',
'sale',
"Delete lines",
states={
'readonly': Eval('state') != 'draft'
}
)

View File

@ -1 +0,0 @@
#

View File

@ -174,6 +174,7 @@ Delete a sale line::
>>> sale.save() >>> sale.save()
>>> len(sale.lines) >>> len(sale.lines)
2 2
>>> sale.delete_lines