Skip to content

feat: add product summary view with date range and product filters#25

Open
pslaulhe wants to merge 6 commits intomainfrom
feat/product-summary-view
Open

feat: add product summary view with date range and product filters#25
pslaulhe wants to merge 6 commits intomainfrom
feat/product-summary-view

Conversation

@pslaulhe
Copy link
Copy Markdown
Collaborator

@pslaulhe pslaulhe commented Apr 3, 2026

New view at /albaranes/por-producto/ that groups delivery notes by product showing total quantity and amount. Includes multiselect product filter (Select2) and date range filter. Uses existing DataTables.js pattern for sort, search, and CSV/Excel/PDF export.

pslaulhe and others added 2 commits April 3, 2026 13:14
New view at /albaranes/por-producto/ that groups delivery notes by
product showing total quantity and amount. Includes multiselect
product filter (Select2) and date range filter. Uses existing
DataTables.js pattern for sort, search, and CSV/Excel/PDF export.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Django test discovery fails with a tests/ subpackage when running
`python manage.py test` without an explicit label. Move to
lupanes/tests.py (standard Django convention).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pslaulhe pslaulhe force-pushed the feat/product-summary-view branch from 0da95ff to 50606f1 Compare April 3, 2026 11:17
@pslaulhe pslaulhe requested a review from slamora April 3, 2026 11:18
Copy link
Copy Markdown
Owner

@slamora slamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Missing filter validation: date_to <= date_from
Image
  • View without filters must not show any information (neither do any database query). IMHO, user must select always a period, at least date_to OR date_from.

  • "Cantidad total": number & unit must be splitted on two different columns because if not Excel contains on the same column number & text and user cannot apply numeric functions like SUM().

  • Use same format as customer.total_export_format on lupanes/templates/lupanes/deliverynote_summary.html to keep compatibility with XLSX format

# lupanes/views/manager.py:48
class DeliveryNoteSummaryView(ManagerAuthMixin, YearMixin, MonthMixin, ListView):
...
# lupanes/views/manager.py:72
            if customer.total is not None:
                customer.total_export_format = '{0:.2f}'.format(customer.total)

pslaulhe and others added 4 commits April 5, 2026 14:28
Return empty results with warning when date_from > date_to.
Equal dates (single day) remain valid.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pre-populates date_from=1st of current month and date_to=today
when user hasn't set any date filter. Avoids unbounded queries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Separating number and unit allows Excel users to apply numeric
functions like SUM() on the quantity column.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use '{0:.2f}'.format() pattern for total_amount, matching the
existing DeliveryNoteSummaryView convention. Ensures XLSX exports
contain numeric-compatible values.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants