Skip to content

Commit

Permalink
Merge pull request #57 from rubencabrera/duplicate-invoices
Browse files Browse the repository at this point in the history
fix: avoid accidental duplicate invoice
  • Loading branch information
rubencabrera authored Apr 26, 2023
2 parents e47d242 + 1c0f181 commit 98dc1a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion partner_portal_extra_details/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import logging

from datetime import date
from odoo import api, fields, models, _
from odoo.exceptions import UserError

Expand Down Expand Up @@ -133,8 +134,13 @@ def _send_mail_to_new_validate_user(self):
account_invoice = invoices = self.env['account.invoice']
dom = [
('partner_id', '=', partner.id),
('state', '=', 'draft')
(
'date_invoice',
'>=',
date(date.today().year, 1, 1).strftime("%Y-%m-%d")
)
]
_logger.debug("Domain: %s", dom)
invoices |= account_invoice.search(
dom, order='date_invoice asc', limit=1
)
Expand Down

0 comments on commit 98dc1a8

Please sign in to comment.