[CLN] website_sale_digital: account_invoice.py

* Right file name
* Right class name
* privatize method not meant to be called in rpc

Part-of: odoo/odoo#116026
This commit is contained in:
Victor Feyens
2023-03-21 22:25:46 +01:00
parent a38a87d3a1
commit a7b065b445
3 changed files with 5 additions and 8 deletions
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
@@ -16,7 +15,7 @@ class WebsiteSaleDigital(CustomerPortal):
@http.route()
def portal_order_page(self, order_id=None, **post):
response = super(WebsiteSaleDigital, self).portal_order_page(order_id=order_id, **post)
response = super().portal_order_page(order_id=order_id, **post)
if not 'sale_order' in response.qcontext:
return response
order = response.qcontext['sale_order']
@@ -68,7 +67,7 @@ class WebsiteSaleDigital(CustomerPortal):
# Check if the user has bought the associated product
res_model = attachment['res_model']
res_id = attachment['res_id']
purchased_products = request.env['account.move.line'].get_digital_purchases()
purchased_products = request.env['account.move.line']._get_digital_purchases()
if res_model == 'product.product':
if res_id not in purchased_products:
@@ -1,6 +1,6 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_invoice
from . import account_move_line
from . import ir_attachment
from . import product_product
from . import product_template
@@ -1,14 +1,12 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class AccountInvoiceLine(models.Model):
class AccountMoveLine(models.Model):
_inherit = ['account.move.line']
def get_digital_purchases(self):
def _get_digital_purchases(self):
partner = self.env.user.partner_id
# Get paid invoices