You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
960 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2018 Rémy Taymans <remytaymans@gmail.com>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp.addons.website_portal_v10.controllers.main import WebsiteAccount
  5. from openerp.http import request
  6. class PortalPosOrderAmount(WebsiteAccount):
  7. def _prepare_portal_layout_values(self):
  8. values = super(
  9. PortalPosOrderAmount, self
  10. )._prepare_portal_layout_values()
  11. user = request.env.user
  12. owned_posorder = request.env["pos.order"].sudo().search(
  13. [
  14. ("partner_id", "=", user.partner_id.commercial_partner_id.id),
  15. ("state", "!=", "cancel"),
  16. ]
  17. )
  18. values["posorder_amount"] = sum(
  19. po.amount_total for po in owned_posorder
  20. )
  21. values["company_currency"] = (
  22. request.env["res.company"]._company_default_get().currency_id
  23. )
  24. return values