[FIX] l10n_sa_invoice: relax constraint for delivery date
We had a constraint(raise) that said that the delivery date needed to be after the invoice date, but this is putting too many constraints. However, we put a help message to say that they should put the date of the last delivery. Also, the delivery date should not be changed once confirmed like the other information in the invoice. X-original-commit: 9e1a0fb37930de3c8cbc0ecf88052e5ddf55d474 Part-of: odoo/odoo#81620
This commit is contained in:
@@ -9,7 +9,9 @@ from odoo.exceptions import UserError
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
l10n_sa_delivery_date = fields.Date(string='Delivery Date', default=fields.Date.context_today, copy=False)
|
||||
l10n_sa_delivery_date = fields.Date(string='Delivery Date', default=fields.Date.context_today, copy=False,
|
||||
readonly=True, states={'draft': [('readonly', False)]},
|
||||
help="In case of multiple deliveries, you should take the date of the latest one. ")
|
||||
l10n_sa_show_delivery_date = fields.Boolean(compute='_compute_show_delivery_date')
|
||||
l10n_sa_qr_code_str = fields.Char(string='Zatka QR Code', compute='_compute_qr_code_str')
|
||||
l10n_sa_confirmation_datetime = fields.Datetime(string='Confirmation Date', readonly=True, copy=False)
|
||||
@@ -50,8 +52,6 @@ class AccountMove(models.Model):
|
||||
if record.country_code == 'SA' and record.move_type in ('out_invoice', 'out_refund'):
|
||||
if not record.l10n_sa_show_delivery_date:
|
||||
raise UserError(_('Delivery Date cannot be empty'))
|
||||
if record.l10n_sa_delivery_date < record.invoice_date:
|
||||
raise UserError(_('Delivery Date cannot be before Invoice Date'))
|
||||
self.write({
|
||||
'l10n_sa_confirmation_datetime': fields.Datetime.now()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user