Improve default date for reversal: D+1 instead of today
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
from . import account_invoice_mark_sent
|
||||
from . import account_move_reversal
|
||||
|
||||
24
account_usability/wizard/account_move_reversal.py
Normal file
24
account_usability/wizard/account_move_reversal.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
|
||||
class AccountMoveReversal(models.TransientModel):
|
||||
_inherit = 'account.move.reversal'
|
||||
|
||||
@api.model
|
||||
def _default_date(self):
|
||||
date = None
|
||||
if (
|
||||
self._context.get('active_model') == 'account.move' and
|
||||
self._context.get('active_id')):
|
||||
move = self.env['account.move'].browse(self._context['active_id'])
|
||||
date_dt = fields.Date.from_string(move.date) +\
|
||||
relativedelta(days=1)
|
||||
date = fields.Date.to_string(date_dt)
|
||||
return date
|
||||
|
||||
date = fields.Date(default=_default_date)
|
||||
Reference in New Issue
Block a user