Añadidos módulos de OCA/e-commerce para la tienda online
This commit is contained in:
parent
10bfdb5a49
commit
c14ed5b4ef
99 changed files with 5359 additions and 0 deletions
5
website_sale_stock_available/models/__init__.py
Normal file
5
website_sale_stock_available/models/__init__.py
Normal 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
|
19
website_sale_stock_available/models/product_product.py
Normal file
19
website_sale_stock_available/models/product_product.py
Normal 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
|
17
website_sale_stock_available/models/product_template.py
Normal file
17
website_sale_stock_available/models/product_template.py
Normal 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)
|
15
website_sale_stock_available/models/sale_order.py
Normal file
15
website_sale_stock_available/models/sale_order.py
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue