[FIX] Add views ref on action open from manually creation invoice from contract

This commit is contained in:
Juliana
2023-01-17 15:42:38 +01:00
committed by remi-filament
parent 1133dc3588
commit 40f62efa99
2 changed files with 8 additions and 1 deletions

View File

@@ -17,7 +17,7 @@
"LasLabs, "
"Odoo Community Association (OCA)",
'website': 'https://github.com/OCA/contract',
'depends': ['base', 'account', 'product', 'portal'],
'depends': ['base', 'account', 'auth_signup', 'product', 'portal'],
"external_dependencies": {"python": ["dateutil"]},
'data': [
'security/groups.xml',

View File

@@ -56,10 +56,17 @@ class ContractManuallyCreateInvoice(models.TransientModel):
invoices = self.env['account.invoice']
for contract in self.contract_to_invoice_ids:
invoices |= contract.recurring_create_invoice()
if self.contract_type == "sale":
tree_view_id = self.env.ref('account.invoice_tree').id
form_view_id = self.env.ref('account.invoice_form').id
else:
tree_view_id = self.env.ref('account.invoice_supplier_tree').id
form_view_id = self.env.ref('account.invoice_supplier_form').id
return {
"type": "ir.actions.act_window",
"name": _("Invoices"),
"res_model": "account.invoice",
"views": [[tree_view_id, "tree"], [form_view_id, "form"]],
"domain": [('id', 'in', invoices.ids)],
"view_mode": "tree,form",
"context": self.env.context,