Files
odoo_source/addons/repair/models/stock_traceability.py
T
Haresh Shyara 68061e2517 [IMP] stock, mrp, repair: optimization traceability report based on stock move lines
- Optimized _lines() to fold/unfold mechanism and use stock move line in get lines.
- Merged into single method (make_dict_move and make_dict_head) to get parent & child traceability result
  and use unfolfable to make line unfoldable.
- Removed _get_produced_or_consumed_vals method and move mechanisam into _line method will do same for this.
- Make some methods private.
- Removed useless vals from dict.
2018-01-31 14:15:00 +01:00

23 lines
890 B
Python

from odoo import models, api
class MrpStockReport(models.TransientModel):
_inherit = 'stock.traceability.report'
@api.model
def _get_reference(self, move_line):
res_model, res_id, ref = super(MrpStockReport, self)._get_reference(move_line)
if move_line.move_id.repair_id:
res_model = 'repair.order'
res_id = move_line.move_id.repair_id.id
ref = move_line.move_id.repair_id.name
return res_model, res_id, ref
@api.model
def _get_linked_move_lines(self, move_line):
move_lines, is_used = super(MrpStockReport, self)._get_linked_move_lines(move_line)
if not move_lines:
move_lines = move_line.move_id.repair_id and move_line.consume_line_ids
if not is_used:
is_used = move_line.move_id.repair_id and move_line.produce_line_ids
return move_lines, is_used