diff --git a/res_partner_forbid_archive_with_invoice/__manifest__.py b/res_partner_forbid_archive_with_invoice/__manifest__.py index 41034e9b..e0fcdcbf 100644 --- a/res_partner_forbid_archive_with_invoice/__manifest__.py +++ b/res_partner_forbid_archive_with_invoice/__manifest__.py @@ -8,14 +8,13 @@ "category": "Accounting & Finance", "author": "Sergio Corato", "summary": "This module stop the user to deactivate partners that have " - "invoices or moves. This would make impossible to find the " - "invoices/moves without knowing their exact number.", + "invoices or moves. This would make impossible to find the " + "invoices/moves without knowing their exact number.", "website": "https://github.com/sergiocorato/e-account", "license": "AGPL-3", "depends": [ "account", ], - "data": [ - ], + "data": [], "installable": True, } diff --git a/res_partner_forbid_archive_with_invoice/models/partner.py b/res_partner_forbid_archive_with_invoice/models/partner.py index 015016ad..c381b8fb 100644 --- a/res_partner_forbid_archive_with_invoice/models/partner.py +++ b/res_partner_forbid_archive_with_invoice/models/partner.py @@ -8,17 +8,20 @@ class ResPartner(models.Model): _inherit = "res.partner" move_line_ids = fields.One2many( - comodel_name='account.move.line', - inverse_name='partner_id', - string='Move Lines', + comodel_name="account.move.line", + inverse_name="partner_id", + string="Move Lines", ) def toggle_active(self): - if any(x.invoice_ids or x.move_line_ids for x in self.filtered( - lambda x: x.active)): - raise UserError(_( - "Some selected partner has registered invoices or moves! \n" - "You cannot deactivate these partners: %s") % ( - " - ".join(self.mapped("name")) - )) + if any( + x.invoice_ids or x.move_line_ids for x in self.filtered(lambda x: x.active) + ): + raise UserError( + _( + "Some selected partner has registered invoices or moves! \n" + "You cannot deactivate these partners: %s" + ) + % (" - ".join(self.mapped("name"))) + ) super().toggle_active()