Skip to content

Commit

Permalink
disponiblitate website (dhongu#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhongu authored Dec 5, 2022
1 parent 1c911e2 commit 0dbd447
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 50 deletions.
1 change: 0 additions & 1 deletion deltatech_website_stock_location/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
# See README.rst file on addons root folder for license details

from . import models
from . import controllers
2 changes: 1 addition & 1 deletion deltatech_website_stock_location/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "eCommerce Stock location",
"category": "Website",
"summary": "Stock Availability From Location",
"version": "15.0.1.0.1",
"version": "15.0.1.0.2",
"author": "Terrabit, Dorin Hongu",
"website": "https://www.terrabit.ro",
"depends": ["website", "website_sale_stock"],
Expand Down
6 changes: 0 additions & 6 deletions deltatech_website_stock_location/controllers/__init__.py

This file was deleted.

42 changes: 0 additions & 42 deletions deltatech_website_stock_location/controllers/main.py

This file was deleted.

1 change: 1 addition & 0 deletions deltatech_website_stock_location/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from . import product
from . import website
from . import res_config_settings
from . import sale_order
18 changes: 18 additions & 0 deletions deltatech_website_stock_location/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# © 2015-2022 Deltatech
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details

from odoo import models


class SaleOrder(models.Model):
_inherit = "sale.order"

def _cart_update(self, product_id=None, line_id=None, add_qty=0, set_qty=0, **kwargs):
if self.website_id:
if not self.website_id.warehouse_id:
self = self.with_context(all_warehouses=True)
if not self.website_id.location_id:
self = self.with_context(all_locations=True)
values = super(SaleOrder, self)._cart_update(product_id, line_id, add_qty, set_qty, **kwargs)
return values
11 changes: 11 additions & 0 deletions deltatech_website_stock_location/models/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,14 @@ def _get_warehouse_available(self):
if not self.location_id:
self = self.with_context(all_locations=True)
return super(Website, self)._get_warehouse_available()

def sale_get_order(self, force_create=False, code=None, update_pricelist=False, force_pricelist=False):
so = super().sale_get_order(
force_create=force_create, code=code, update_pricelist=update_pricelist, force_pricelist=force_pricelist
)
if so and so.website_id:
if not so.website_id.warehouse_id:
so = so.with_context(all_warehouses=True)
if not so.website_id.location_id:
so = so.with_context(all_locations=True)
return so

0 comments on commit 0dbd447

Please sign in to comment.