Skip to content

Commit

Permalink
WIP set default show_move_lines to True
Browse files Browse the repository at this point in the history
  • Loading branch information
louck committed Sep 24, 2024
1 parent 2b7d477 commit 836750d
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion commown_devices/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class Contract(models.Model):

lot_nb = fields.Integer("Number of lots", compute="_compute_lot_nb", store=True)

show_all_view_move_lines = fields.Boolean("Show all move lines", default=True)
show_all_view_move_lines = fields.Boolean(
"Show all move lines", default=True, store=False
)

move_line_view_ids = fields.One2many(
"stock.move.line",
Expand All @@ -36,6 +38,39 @@ class Contract(models.Model):
store=False,
)

"""
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
if context is None:
context = {}
res = super().read(cr, uid, ids, fields=fields, context=context, load=load)
idx = 0
for r in res:
if r.has_key('show_all_view_move_lines'):
r['show_all_view_move_lines'] = True
#replace line above with replacement value from external database
res[idx] = r
idx = idx + 1
return res
@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
submenu=False):
params = self._context.get("params")
if params is not None:
model = params.get("model")
id = params.get("id")
if model is not None and id is not None:
import ipdb; ipdb.set_trace()
self.env.cache.invalidate()
contract = self.env[model].browse(id)
contract.show_all_view_move_lines = True
res = super().fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu
)
return res
"""

def pending_picking(self):
return self.move_ids.mapped("picking_id").filtered(_assigned)

Expand Down

0 comments on commit 836750d

Please sign in to comment.