mirror of
https://github.com/bringout/oca-ocb-accounting.git
synced 2026-04-23 06:02:01 +02:00
Initial commit: Accounting packages
This commit is contained in:
commit
4ef34c2317
2661 changed files with 1709616 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from odoo import api, models, fields, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class IrAttachment(models.Model):
|
||||
_inherit = 'ir.attachment'
|
||||
|
||||
@api.ondelete(at_uninstall=False)
|
||||
def _unlink_except_government_document(self):
|
||||
linked_edi_documents = self.env['account.edi.document'].search([('attachment_id', 'in', self.ids)])
|
||||
linked_edi_formats_ws = linked_edi_documents.edi_format_id.filtered(lambda edi_format: edi_format._needs_web_services())
|
||||
if linked_edi_formats_ws:
|
||||
raise UserError(_("You can't unlink an attachment being an EDI document sent to the government."))
|
||||
Loading…
Add table
Add a link
Reference in a new issue