Merge PR #917 into 12.0

Signed-off-by rousseldenis
This commit is contained in:
OCA-git-bot
2024-02-09 14:15:06 +00:00
2 changed files with 8 additions and 1 deletions

View File

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

View File

@@ -56,10 +56,17 @@ class ContractManuallyCreateInvoice(models.TransientModel):
invoices = self.env['account.invoice'] invoices = self.env['account.invoice']
for contract in self.contract_to_invoice_ids: for contract in self.contract_to_invoice_ids:
invoices |= contract.recurring_create_invoice() 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 { return {
"type": "ir.actions.act_window", "type": "ir.actions.act_window",
"name": _("Invoices"), "name": _("Invoices"),
"res_model": "account.invoice", "res_model": "account.invoice",
"views": [[tree_view_id, "tree"], [form_view_id, "form"]],
"domain": [('id', 'in', invoices.ids)], "domain": [('id', 'in', invoices.ids)],
"view_mode": "tree,form", "view_mode": "tree,form",
"context": self.env.context, "context": self.env.context,