mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[14.0][IMP] account_move_line_mrp_info: journal items are now accessed from a smart button
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
from ast import literal_eval
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
@@ -11,6 +12,24 @@ class MrpProduction(models.Model):
|
||||
comodel_name="account.move.line", inverse_name="mrp_production_id", copy=False
|
||||
)
|
||||
|
||||
def view_journal_items(self):
|
||||
self.ensure_one()
|
||||
domain = [
|
||||
(
|
||||
"id",
|
||||
"in",
|
||||
(self.account_move_line_ids).ids,
|
||||
)
|
||||
]
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"account_move_line_mrp_info.action_view_journal_items"
|
||||
)
|
||||
context = literal_eval(action["context"])
|
||||
context.update(self.env.context)
|
||||
context["no_at_date"] = True
|
||||
context["search_default_group_by_product_id"] = False
|
||||
return dict(action, domain=domain, context=context)
|
||||
|
||||
|
||||
class MrpUnbuild(models.Model):
|
||||
_inherit = "mrp.unbuild"
|
||||
@@ -18,3 +37,21 @@ class MrpUnbuild(models.Model):
|
||||
account_move_line_ids = fields.One2many(
|
||||
comodel_name="account.move.line", inverse_name="unbuild_id", copy=False
|
||||
)
|
||||
|
||||
def view_journal_items(self):
|
||||
self.ensure_one()
|
||||
domain = [
|
||||
(
|
||||
"id",
|
||||
"in",
|
||||
(self.account_move_line_ids).ids,
|
||||
)
|
||||
]
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"account_move_line_mrp_info.action_view_journal_items"
|
||||
)
|
||||
context = literal_eval(action["context"])
|
||||
context.update(self.env.context)
|
||||
context["no_at_date"] = True
|
||||
context["search_default_group_by_product_id"] = False
|
||||
return dict(action, domain=domain, context=context)
|
||||
|
||||
Reference in New Issue
Block a user