[FIX] account, membership: Fix use of date.min() in place of '0000-00-00'
Avoid traceback by: TypeError: '>' not supported between instances of 'datetime.date' and 'str' After that was migrated the use of native date/datetime for Date/Datetime fields. Based on https://github.com/odoo/odoo/commit/960360afe478a8f7b9c456721b5591154952a37d#diff-dd671a54296b170ea1393dca1a5f7798L348 closes odoo/odoo#27819
This commit is contained in:
@@ -1582,7 +1582,7 @@ class AccountPartialReconcile(models.Model):
|
||||
full_to_unlink |= rec.full_reconcile_id
|
||||
#reverse the tax basis move created at the reconciliation time
|
||||
for move in self.env['account.move'].search([('tax_cash_basis_rec_id', 'in', self._ids)]):
|
||||
if move.date > (move.company_id.period_lock_date or '0000-00-00'):
|
||||
if move.date > (move.company_id.period_lock_date or date.min):
|
||||
move.reverse_moves(date=move.date)
|
||||
else:
|
||||
move.reverse_moves()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from datetime import date
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from . import membership
|
||||
@@ -114,7 +115,7 @@ class Partner(models.Model):
|
||||
s = 4
|
||||
if partner.member_lines:
|
||||
for mline in partner.member_lines:
|
||||
if (mline.date_to or '0000-00-00') >= today and (mline.date_from or '0000-00-00') <= today:
|
||||
if (mline.date_to or date.min) >= today and (mline.date_from or date.min) <= today:
|
||||
if mline.account_invoice_line.invoice_id.partner_id == partner:
|
||||
mstate = mline.account_invoice_line.invoice_id.state
|
||||
if mstate == 'paid':
|
||||
@@ -132,7 +133,7 @@ class Partner(models.Model):
|
||||
s = 3
|
||||
if s == 4:
|
||||
for mline in partner.member_lines:
|
||||
if (mline.date_from or '0000-00-00') < today and (mline.date_to or '0000-00-00') < today and (mline.date_from or '0000-00-00') <= (mline.date_to or '0000-00-00') and mline.account_invoice_line and mline.account_invoice_line.invoice_id.state == 'paid':
|
||||
if (mline.date_from or date.min) < today and (mline.date_to or date.min) < today and (mline.date_from or date.min) <= (mline.date_to or date.min) and mline.account_invoice_line and mline.account_invoice_line.invoice_id.state == 'paid':
|
||||
s = 5
|
||||
else:
|
||||
s = 6
|
||||
|
||||
Reference in New Issue
Block a user