Browse Source

[12.0][IMP] - log the manual invoice action in contract chatter

pull/414/head
sbejaoui 5 years ago
parent
commit
72d62e3024
  1. 4
      contract/models/contract.py
  2. 1
      contract/security/ir.model.access.csv
  3. 13
      contract/wizards/contract_manually_create_invoice.py
  4. 1
      contract/wizards/contract_manually_create_invoice.xml

4
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

1
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

13
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"),

1
contract/wizards/contract_manually_create_invoice.xml

@ -51,6 +51,7 @@
<record model="ir.ui.menu" id="contract_manually_create_invoice_menu">
<field name="name">Manually Invoice Contracts</field>
<field name="parent_id" ref="account.menu_finance"/>
<field name="groups_id" eval="[(6, 0, [ref('account.group_account_manager')])]"/>
<field name="action"
ref="contract_manually_create_invoice_act_window"/>
<field name="sequence" eval="16"/>

Loading…
Cancel
Save