Reset open_date when going back to draft
Since it is possible to go back to draft for supplier invoice even if a number was set. The open_date should be reset in draft. review764002
This commit is contained in:
1 parent
d7fc246fa4
commit
4e8735626e
1 file changed
+10
-1
+10
-1
@@ -2,7 +2,7 @@
|
||||
#this repository contains the full copyright notices and license terms.
|
||||
import datetime
|
||||
|
||||
from trytond.model import fields
|
||||
from trytond.model import ModelView, Workflow, fields
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
__all__ = ['Invoice']
|
||||
@@ -34,6 +34,15 @@ class Invoice:
|
||||
'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:
|
||||
|
||||
Reference in new issue
Block a user