[IMP] Align with open invoice wizard: check date range, minor cleanup.
parent
7ad3c39230
commit
28674278cd
|
@ -4,6 +4,7 @@
|
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from datetime import datetime
|
||||
from openerp.exceptions import Warning as UserError
|
||||
from openerp import api, fields, models
|
||||
|
||||
|
||||
|
@ -13,12 +14,11 @@ class AccountAgedTrialBalance(models.TransientModel):
|
|||
_description = 'Aged partner balanced'
|
||||
|
||||
company_id = fields.Many2one(
|
||||
comodel_name='res.company',
|
||||
'res.company',
|
||||
string='Company',
|
||||
required=True
|
||||
)
|
||||
date_from = fields.Date('Date from')
|
||||
date_to = fields.Date('Date to')
|
||||
required=True,
|
||||
default=lambda s: s.env.user.company_id
|
||||
)
|
||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
||||
('all', 'All Entries')],
|
||||
string='Target Moves',
|
||||
|
@ -53,6 +53,14 @@ class AccountAgedTrialBalance(models.TransientModel):
|
|||
def onchange_atdate(self):
|
||||
self.until_date = self.at_date
|
||||
|
||||
@api.onchange('until_date')
|
||||
def onchange_untildate(self):
|
||||
# ---- until_date must be always >= of at_date
|
||||
if self.until_date:
|
||||
if self.until_date < self.at_date:
|
||||
raise UserError(
|
||||
'Until Date must be equal or greater than At Date')
|
||||
|
||||
@api.multi
|
||||
def check_report(self):
|
||||
return True
|
||||
return True
|
||||
|
|
|
@ -56,7 +56,7 @@ class OpenInvoiceWizard(models.TransientModel):
|
|||
if self.until_date:
|
||||
if self.until_date < self.at_date:
|
||||
raise UserError(
|
||||
'Until Date must be equal or greater then At Date')
|
||||
'Until Date must be equal or greater than At Date')
|
||||
|
||||
@api.multi
|
||||
def print_report(self):
|
||||
|
|
Loading…
Reference in New Issue