Añadidos módulos de OCA/e-commerce para la tienda online

This commit is contained in:
santiky 2021-09-14 14:07:34 +02:00
parent 10bfdb5a49
commit c14ed5b4ef
Signed by: snt
GPG key ID: A9FD34930EADBE71
99 changed files with 5359 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import product_product
from . import product_template
from . import sale_order

View file

@ -0,0 +1,19 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class Product(models.Model):
_inherit = 'product.product'
def _compute_quantities_dict(self, lot_id, owner_id, package_id,
from_date=False, to_date=False):
res = super()._compute_quantities_dict(
lot_id, owner_id, package_id, from_date, to_date)
if self.env.context.get('website_sale_stock_available'):
for product in self.with_context(
website_sale_stock_available=False):
immediately = product.immediately_usable_qty
res[product.id]['virtual_available'] = immediately
return res

View file

@ -0,0 +1,17 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, api
class ProductTemplate(models.Model):
_inherit = 'product.template'
@api.multi
def _get_combination_info(self, combination=False, product_id=False,
add_qty=1, pricelist=False,
parent_combination=False, only_template=False):
template = self.with_context(website_sale_stock_available=True)
return super(ProductTemplate, template)._get_combination_info(
combination, product_id, add_qty, pricelist, parent_combination,
only_template)

View file

@ -0,0 +1,15 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models
class SaleOrder(models.Model):
_inherit = 'sale.order'
@api.multi
def _cart_update(self, product_id=None, line_id=None, add_qty=0,
set_qty=0, **kwargs):
order = self.with_context(website_sale_stock_available=True)
return super(SaleOrder, order)._cart_update(
product_id, line_id, add_qty, set_qty, **kwargs)