changeset d7e862aa61b6 in modules/account_invoice_history:default
details:
https://hg.tryton.org/modules/account_invoice_history?cmd=changeset;node=d7e862aa61b6
description:
Add history on payment term line delta
And use correct file names per class.
issue7866
review58421002
diffstat:
CHANGELOG | 2 ++
__init__.py | 17 +++++++++--------
account.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
account_invoice.py | 18 ++++++++++++++++++
invoice.py | 53 -----------------------------------------------------
payment_term.py | 15 ---------------
6 files changed, 82 insertions(+), 76 deletions(-)
diffs (193 lines):
diff -r f66e4da8c003 -r d7e862aa61b6 CHANGELOG
--- a/CHANGELOG Mon Oct 01 13:06:55 2018 +0200
+++ b/CHANGELOG Wed Nov 28 09:57:17 2018 +0100
@@ -1,3 +1,5 @@
+* Add history on payment term line delta
+
Version 5.0.0 - 2018-10-01
* Bug fixes (see mercurial logs for details)
* Remove support for Python 2.7
diff -r f66e4da8c003 -r d7e862aa61b6 __init__.py
--- a/__init__.py Mon Oct 01 13:06:55 2018 +0200
+++ b/__init__.py Wed Nov 28 09:57:17 2018 +0100
@@ -2,16 +2,17 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
-from .party import *
-from .payment_term import *
-from .invoice import *
+from . import party
+from . import account
+from . import account_invoice
def register():
Pool.register(
- Party,
- Address,
- PaymentTerm,
- PaymentTermLine,
- Invoice,
+ party.Party,
+ party.Address,
+ account.Invoice,
+ account_invoice.PaymentTerm,
+ account_invoice.PaymentTermLine,
+ account_invoice.PaymentTermLineRelativeDelta,
module='account_invoice_history', type_='model')
diff -r f66e4da8c003 -r d7e862aa61b6 account.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/account.py Wed Nov 28 09:57:17 2018 +0100
@@ -0,0 +1,53 @@
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
+import datetime
+
+from trytond.model import ModelView, Workflow, fields
+from trytond.pool import PoolMeta
+
+__all__ = ['Invoice']
+
+
+class Invoice(metaclass=PoolMeta):
+ __name__ = 'account.invoice'
+ open_date = fields.Timestamp('Open Date')
+
+ @classmethod
+ def __setup__(cls):
+ super(Invoice, cls).__setup__()
+ cls.party.datetime_field = 'open_date'
+ if 'open_date' not in cls.party.depends:
+ cls.party.depends.append('open_date')
+ cls.invoice_address.datetime_field = 'open_date'
+ if 'open_date' not in cls.invoice_address.depends:
+ cls.invoice_address.depends.append('open_date')
+ cls.payment_term.datetime_field = 'open_date'
+ if 'open_date' not in cls.payment_term.depends:
+ cls.payment_term.depends.append('open_date')
+
+ @classmethod
+ def set_number(cls, invoices):
+ set_open_date = [i for i in invoices if not i.number]
+ super(Invoice, cls).set_number(invoices)
+ if set_open_date:
+ cls.write(set_open_date, {
+ 'open_date': datetime.datetime.now(),
+ })
+
+ @classmethod
+ @ModelView.button
+ @Workflow.transition('draft')
+ def draft(cls, invoices):
+ super(Invoice, cls).draft(invoices)
+ cls.write(invoices, {
+ 'open_date': None,
+ })
+
+ @classmethod
+ def copy(cls, invoices, default=None):
+ if default is None:
+ default = {}
+ else:
+ default = default.copy()
+ default.setdefault('open_date', None)
+ return super(Invoice, cls).copy(invoices, default=default)
diff -r f66e4da8c003 -r d7e862aa61b6 account_invoice.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/account_invoice.py Wed Nov 28 09:57:17 2018 +0100
@@ -0,0 +1,18 @@
+# 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
+
+
+class PaymentTerm(metaclass=PoolMeta):
+ __name__ = 'account.invoice.payment_term'
+ _history = True
+
+
+class PaymentTermLine(metaclass=PoolMeta):
+ __name__ = 'account.invoice.payment_term.line'
+ _history = True
+
+
+class PaymentTermLineRelativeDelta(metaclass=PoolMeta):
+ __name__ = 'account.invoice.payment_term.line.delta'
+ _history = True
diff -r f66e4da8c003 -r d7e862aa61b6 invoice.py
--- a/invoice.py Mon Oct 01 13:06:55 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,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.
-import datetime
-
-from trytond.model import ModelView, Workflow, fields
-from trytond.pool import PoolMeta
-
-__all__ = ['Invoice']
-
-
-class Invoice(metaclass=PoolMeta):
- __name__ = 'account.invoice'
- open_date = fields.Timestamp('Open Date')
-
- @classmethod
- def __setup__(cls):
- super(Invoice, cls).__setup__()
- cls.party.datetime_field = 'open_date'
- if 'open_date' not in cls.party.depends:
- cls.party.depends.append('open_date')
- cls.invoice_address.datetime_field = 'open_date'
- if 'open_date' not in cls.invoice_address.depends:
- cls.invoice_address.depends.append('open_date')
- cls.payment_term.datetime_field = 'open_date'
- if 'open_date' not in cls.payment_term.depends:
- cls.payment_term.depends.append('open_date')
-
- @classmethod
- def set_number(cls, invoices):
- set_open_date = [i for i in invoices if not i.number]
- super(Invoice, cls).set_number(invoices)
- if set_open_date:
- cls.write(set_open_date, {
- 'open_date': datetime.datetime.now(),
- })
-
- @classmethod
- @ModelView.button
- @Workflow.transition('draft')
- def draft(cls, invoices):
- super(Invoice, cls).draft(invoices)
- cls.write(invoices, {
- 'open_date': None,
- })
-
- @classmethod
- def copy(cls, invoices, default=None):
- if default is None:
- default = {}
- else:
- default = default.copy()
- default.setdefault('open_date', None)
- return super(Invoice, cls).copy(invoices, default=default)
diff -r f66e4da8c003 -r d7e862aa61b6 payment_term.py
--- a/payment_term.py Mon Oct 01 13:06:55 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,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.
-from trytond.pool import PoolMeta
-
-__all__ = ['PaymentTerm', 'PaymentTermLine']
-
-
-class PaymentTerm(metaclass=PoolMeta):
- __name__ = 'account.invoice.payment_term'
- _history = True
-
-
-class PaymentTermLine(metaclass=PoolMeta):
- __name__ = 'account.invoice.payment_term.line'
- _history = True