diff --git a/contract/models/contract.py b/contract/models/contract.py index a91fdf08..b648a68f 100644 --- a/contract/models/contract.py +++ b/contract/models/contract.py @@ -452,6 +452,10 @@ class ContractContract(models.Model): This method triggers the creation of the next invoices of the contracts even if their next invoicing date is in the future. """ + self.message_post( + body=_("Manually invoiced. Invoice date: %s") + % self.recurring_next_date + ) return self._recurring_create_invoice() @api.multi diff --git a/contract/security/ir.model.access.csv b/contract/security/ir.model.access.csv index 05395a7d..4b3e42de 100644 --- a/contract/security/ir.model.access.csv +++ b/contract/security/ir.model.access.csv @@ -7,4 +7,3 @@ "contract_line_user","Recurring user","model_contract_line","account.group_account_invoice",1,0,0,0 "contract_template_line_manager","Recurring manager","model_contract_template_line","account.group_account_manager",1,1,1,1 "contract_template_line_user","Recurring user","model_contract_template_line","account.group_account_invoice",1,0,0,0 -"contract_manually_create_invoice_manager","Recurring manager access to manually invoice contract action","model_contract_manually_create_invoice","account.group_account_manager",1,1,1,0 diff --git a/contract/wizards/contract_manually_create_invoice.py b/contract/wizards/contract_manually_create_invoice.py index 3f64ec34..3dad2271 100644 --- a/contract/wizards/contract_manually_create_invoice.py +++ b/contract/wizards/contract_manually_create_invoice.py @@ -4,7 +4,7 @@ from odoo import api, fields, models, _ -class ContractManuallyCreateInvoice(models.Model): +class ContractManuallyCreateInvoice(models.TransientModel): _name = 'contract.manually.create.invoice' _description = 'Contract Manually Create Invoice Wizard' @@ -49,9 +49,18 @@ class ContractManuallyCreateInvoice(models.Model): @api.multi def create_invoice(self): self.ensure_one() - invoices = self.env['contract.contract'].cron_recurring_create_invoice( + contract_model = self.env['contract.contract'] + contracts = contract_model.search( + contract_model._get_contracts_to_invoice_domain(self.invoice_date) + ) + invoices = contract_model.cron_recurring_create_invoice( self.invoice_date ) + for contract in contracts: + contract.message_post( + body=_("Manually invoiced. Invoice date: %s") + % self.invoice_date + ) return { "type": "ir.actions.act_window", "name": _("Invoices"), diff --git a/contract/wizards/contract_manually_create_invoice.xml b/contract/wizards/contract_manually_create_invoice.xml index b5786513..948111a7 100644 --- a/contract/wizards/contract_manually_create_invoice.xml +++ b/contract/wizards/contract_manually_create_invoice.xml @@ -51,6 +51,7 @@ Manually Invoice Contracts +