[FIX] l10n_latam_invoice_document: prevent delete document number if invoice date is assigned.
Task latam: 1137 Task Adhoc: 33333 Prevent delete document number if invoice date is assigned (manual documents). Description of the issue/feature this PR addresses: On a draft vendor bill (manual documents) if the document number setted, and then if the user set a date, the document number is automatically cleaned and it`s must not be cleaned. Current behavior before PR: On a draft vendor bill if the document number setted, and then if the user set a date, the document number is automatically cleaned. Desired behavior after PR is merged: On a draft vendor bill if the document number setted, and then if the user set a date, the document number is not automatically cleaned. closes odoo/odoo#147242 X-original-commit: 8212f7dd73028fa6c68819218e1e63fe60d71913 Signed-off-by: Josse Colpaert <jco@odoo.com>
This commit is contained in:
@@ -82,7 +82,7 @@ class AccountMove(models.Model):
|
||||
when we change the document type) """
|
||||
without_doc_type = self.filtered(lambda x: x.journal_id.l10n_latam_use_documents and not x.l10n_latam_document_type_id)
|
||||
manual_documents = self.filtered(lambda x: x.journal_id.l10n_latam_use_documents and x.l10n_latam_manual_document_number)
|
||||
(without_doc_type + manual_documents.filtered(lambda x: not x.name or x.name and x.state == 'draft' and not x.posted_before)).name = '/'
|
||||
(without_doc_type + manual_documents.filtered(lambda x: not x.name)).name = '/'
|
||||
# we need to group moves by document type as _compute_name will apply the same name prefix of the first record to the others
|
||||
group_by_document_type = defaultdict(self.env['account.move'].browse)
|
||||
for move in (self - without_doc_type - manual_documents):
|
||||
|
||||
Reference in New Issue
Block a user