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.

28 lines
919 B

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