diff options
| author | Vipul Bhatt <vbh@odoo.com> | 2016-04-12 10:22:19 +0200 |
|---|---|---|
| committer | Jérome Maes <jem@openerp.com> | 2016-05-27 10:50:34 +0200 |
| commit | 4dfbcecfdb59c12eaf4b3b435a626f07574d5ce3 (patch) | |
| tree | 7a4dd35f9217c52dbfdf9caa0e51a11f5bc309ad /addons/website_project_issue/controllers | |
| parent | a999969f81f67d38cf17c29e208e954b72560de9 (diff) | |
[IMP] website_{portal,portal_sale,project_issue,quote} : add pager for customer documents
This commit adds controller to list documents of customer, with pager and archive
widget to sort documents. Impacted documents are : quotations, sale order,
invoices, and issues.
Portal breadcrumd is improved too : add the home icon, and keep the query
params when using archive widget.
Some editable zones were added to templates, allowing people to customize
their frontend portal.
Diffstat (limited to 'addons/website_project_issue/controllers')
| -rw-r--r-- | addons/website_project_issue/controllers/main.py | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/addons/website_project_issue/controllers/main.py b/addons/website_project_issue/controllers/main.py index 98f06c0c281..64b006e2f42 100644 --- a/addons/website_project_issue/controllers/main.py +++ b/addons/website_project_issue/controllers/main.py @@ -6,17 +6,46 @@ from openerp.http import request class WebsiteAccount(website_account): - @http.route(['/my', '/my/home'], type='http', auth="user", website=True) + + @http.route() def account(self): response = super(WebsiteAccount, self).account() - user = request.env.user - project_issues = request.env['project.issue'].search([]) - response.qcontext.update({'issues': project_issues}) + issue_count = request.env['project.issue'].search_count([]) + response.qcontext.update({'issue_count': issue_count}) return response + @http.route(['/my/issues', '/my/issues/page/<int:page>'], type='http', auth="user", website=True) + def portal_my_issues(self, page=1, date_begin=None, date_end=None, **kw): + values = self._prepare_portal_layout_values() + ProjectIssue = request.env['project.issue'] + domain = [] + # archive groups - Default Group By 'create_date' + archive_groups = self._get_archive_groups('project.issue', domain) + if date_begin and date_end: + domain += [('create_date', '>=', date_begin), ('create_date', '<', date_end)] + # pager + issue_count = ProjectIssue.search_count(domain) + pager = request.website.pager( + url="/my/issues", + url_args={'date_begin': date_begin, 'date_end': date_end}, + total=issue_count, + page=page, + step=self._items_per_page + ) + # content according to pager and archive selected + project_issues = ProjectIssue.search(domain, order="stage_id", limit=self._items_per_page, offset=pager['offset']) + + values.update({ + 'date': date_begin, + 'issues': project_issues, + 'page_name': 'issue', + 'archive_groups': archive_groups, + 'default_url': '/my/issues', + 'pager': pager + }) + return request.website.render("website_project_issue.portal_my_issues", values) -class WebsiteProjectIssue(http.Controller): @http.route(['/my/issues/<int:issue_id>'], type='http', auth="user", website=True) - def issues_followup(self, issue_id=None): + def issues_followup(self, issue_id=None, **kw): issue = request.env['project.issue'].browse(issue_id) return request.website.render("website_project_issue.issues_followup", {'issue': issue}) |
