mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] contract: add default_move_type in context
This commit is contained in:
committed by
Christopher Rogos
parent
03f756eeea
commit
1b1b2fd477
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "Recurring - Contracts Management",
|
"name": "Recurring - Contracts Management",
|
||||||
"version": "15.0.1.2.0",
|
"version": "15.0.1.2.1",
|
||||||
"category": "Contract Management",
|
"category": "Contract Management",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "Tecnativa, ACSONE SA/NV, Odoo Community Association (OCA)",
|
"author": "Tecnativa, ACSONE SA/NV, Odoo Community Association (OCA)",
|
||||||
|
|||||||
@@ -278,12 +278,20 @@ class ContractContract(models.Model):
|
|||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
tree_view = self.env.ref("account.view_invoice_tree", raise_if_not_found=False)
|
tree_view = self.env.ref("account.view_invoice_tree", raise_if_not_found=False)
|
||||||
form_view = self.env.ref("account.view_move_form", raise_if_not_found=False)
|
form_view = self.env.ref("account.view_move_form", raise_if_not_found=False)
|
||||||
|
ctx = dict(self.env.context)
|
||||||
|
if ctx.get("default_contract_type"):
|
||||||
|
ctx["default_move_type"] = (
|
||||||
|
"out_invoice"
|
||||||
|
if ctx.get("default_contract_type") == "sale"
|
||||||
|
else "in_invoice"
|
||||||
|
)
|
||||||
action = {
|
action = {
|
||||||
"type": "ir.actions.act_window",
|
"type": "ir.actions.act_window",
|
||||||
"name": "Invoices",
|
"name": "Invoices",
|
||||||
"res_model": "account.move",
|
"res_model": "account.move",
|
||||||
"view_mode": "tree,kanban,form,calendar,pivot,graph,activity",
|
"view_mode": "tree,kanban,form,calendar,pivot,graph,activity",
|
||||||
"domain": [("id", "in", self._get_related_invoices().ids)],
|
"domain": [("id", "in", self._get_related_invoices().ids)],
|
||||||
|
"context": ctx,
|
||||||
}
|
}
|
||||||
if tree_view and form_view:
|
if tree_view and form_view:
|
||||||
action["views"] = [(tree_view.id, "tree"), (form_view.id, "form")]
|
action["views"] = [(tree_view.id, "tree"), (form_view.id, "form")]
|
||||||
|
|||||||
Reference in New Issue
Block a user