feat: add product summary view with date range and product filters#25
Open
feat: add product summary view with date range and product filters#25
Conversation
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>
0da95ff to
50606f1
Compare
slamora
requested changes
Apr 3, 2026
Owner
There was a problem hiding this comment.
- Missing filter validation: date_to <= date_from
-
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_formatonlupanes/templates/lupanes/deliverynote_summary.htmlto 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)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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.