Skip to content

Commit

Permalink
[IMP] account_invoice_report_grouped_by_picking: Add possibility to s…
Browse files Browse the repository at this point in the history
…et custom order at lines
  • Loading branch information
CarlosRoca13 committed Dec 20, 2023
1 parent dfb10dc commit a98c752
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions account_invoice_report_grouped_by_picking/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _process_section_note_lines_grouped(
if previous_note and key_note not in lines_dic:
lines_dic[key_note] = 0.0

def lines_grouped_by_picking(self):
def lines_grouped_by_picking(self, sorted_lines=False):
"""This prepares a data structure for printing the invoice report
grouped by pickings."""
self.ensure_one()
Expand All @@ -69,9 +69,11 @@ def lines_grouped_by_picking(self):
so_dict = {x.sale_id: x for x in self.picking_ids if x.sale_id}
# Now group by picking by direct link or via same SO as picking's one
previous_section = previous_note = False
for line in self.invoice_line_ids.sorted(
lambda ln: (-ln.sequence, ln.date, ln.move_name, -ln.id), reverse=True
):
if not sorted_lines:
sorted_lines = self.invoice_line_ids.sorted(
lambda ln: (-ln.sequence, ln.date, ln.move_name, -ln.id), reverse=True
)
for line in sorted_lines:
if line.display_type == "line_section":
previous_section = line
continue
Expand Down

0 comments on commit a98c752

Please sign in to comment.