diff --git a/models/acc_contract.py b/models/acc_contract.py index 07185cf25dc28f791303989809fccc65f4efe02d..1a8271ada7a8d7bce3def7f2e0055e110ec57989 100644 --- a/models/acc_contract.py +++ b/models/acc_contract.py @@ -49,19 +49,20 @@ class AccContract(models.Model): # ------------------------------------------------------ @api.model_create_multi def create(self, vals_list): - doc = super(AccContract, self).create(vals_list) + docs = super(AccContract, self).create(vals_list) - if doc.seller_id: - template = self.env.ref( - "acc_operation.email_template_document", raise_if_not_found=False - ) - template.with_context().send_mail(doc.seller_id.id, force_send=True) - if doc.buyer_id: - template = self.env.ref( - "acc_operation.email_template_document", raise_if_not_found=False - ) - template.with_context().send_mail(doc.buyer_id.id, force_send=True) - return doc + for doc in docs: + if doc.seller_id: + template = self.env.ref( + "acc_operation.email_template_document", raise_if_not_found=False + ) + template.with_context().send_mail(doc.seller_id.id, force_send=True) + if doc.buyer_id: + template = self.env.ref( + "acc_operation.email_template_document", raise_if_not_found=False + ) + template.with_context().send_mail(doc.buyer_id.id, force_send=True) + return docs # ------------------------------------------------------ # Actions