Skip to content

Commit 1f17fda

Browse files
[4507][ADD] website_sale_default_warehouse (#223)
* [ADD] website_sale_default_warehouse
1 parent 54fb751 commit 1f17fda

File tree

9 files changed

+518
-0
lines changed

9 files changed

+518
-0
lines changed
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
==============================
2+
Website Sale Default Warehouse
3+
==============================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Beta
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-qrtl%2Fpci--custom-lightgray.png?logo=github
17+
:target: https://github.com/qrtl/pci-custom/tree/10.0/website_sale_default_warehouse
18+
:alt: qrtl/pci-custom
19+
20+
|badge1| |badge2| |badge3|
21+
22+
This module sets the default warehouse in a sale order originating from website sales.
23+
24+
**Table of contents**
25+
26+
.. contents::
27+
:local:
28+
29+
Bug Tracker
30+
===========
31+
32+
Bugs are tracked on `GitHub Issues <https://github.com/qrtl/pci-custom/issues>`_.
33+
In case of trouble, please check there if your issue has already been reported.
34+
If you spotted it first, help us smashing it by providing a detailed and welcomed
35+
`feedback <https://github.com/qrtl/pci-custom/issues/new?body=module:%20website_sale_default_warehouse%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
36+
37+
Do not contact contributors directly about support or help with technical issues.
38+
39+
Credits
40+
=======
41+
42+
Authors
43+
~~~~~~~
44+
45+
* Quartile Limited
46+
47+
Maintainers
48+
~~~~~~~~~~~
49+
50+
This module is part of the `qrtl/pci-custom <https://github.com/qrtl/pci-custom/tree/10.0/website_sale_default_warehouse>`_ project on GitHub.
51+
52+
You are welcome to contribute.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2024 Quartile Limited
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Website Sale Default Warehouse",
5+
"version": "10.0.1.0.0",
6+
"category": "Website",
7+
"author": "Quartile Limited",
8+
"license": "AGPL-3",
9+
"website": "https://www.quartile.co",
10+
"depends": ["website_sale_stock",],
11+
"data": ["views/res_company_views.xml"],
12+
"installable": True,
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import res_company
2+
from . import website
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright 2024 Quartile Limited
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResCompany(models.Model):
8+
_inherit = 'res.company'
9+
10+
default_website_warehouse_id = fields.Many2one("stock.warehouse")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2024 Quartile Limited
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, models
5+
6+
7+
class Website(models.Model):
8+
_inherit = 'website'
9+
10+
@api.multi
11+
def _prepare_sale_order_values(self, partner, pricelist):
12+
values = super(Website, self)._prepare_sale_order_values(partner, pricelist)
13+
if values['company_id']:
14+
warehouse = self.env['res.company'].browse(values['company_id']).default_website_warehouse_id
15+
if warehouse:
16+
values['warehouse_id'] = warehouse.id
17+
return values
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module sets the default warehouse in a sale order originating from website sales.

0 commit comments

Comments
 (0)