[FIX] account: assign current date in due_date if date_ref not available
Unsupported operand type(s) for +: 'NoneType' and 'relativedelta' occur when we create payment terms without a preview date (date_ref). This is because date_ref has no value. This commit solves the issue by adding a condition if date_ref is not available, so it adds current date instead of it. sentry-4068322613 closes odoo/odoo#119187 X-original-commit: a9f556c0d45c32574c94765462d4b59726fc3f19 Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -263,7 +263,7 @@ class AccountPaymentTermLine(models.Model):
|
||||
|
||||
def _get_due_date(self, date_ref):
|
||||
self.ensure_one()
|
||||
due_date = fields.Date.from_string(date_ref)
|
||||
due_date = fields.Date.from_string(date_ref) or fields.Date.today()
|
||||
if self.delay_type == 'days_after_end_of_month':
|
||||
return date_utils.end_of(due_date, 'month') + relativedelta(days=self.nb_days)
|
||||
elif self.delay_type == 'days_after_end_of_next_month':
|
||||
|
||||
Reference in New Issue
Block a user