-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] website_sale_default_warehouse
- Loading branch information
1 parent
54fb751
commit 3ed0c42
Showing
7 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2024 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Website Sale Default Warehouse", | ||
"version": "10.0.1.0.0", | ||
"category": "Website", | ||
"author": "Quartile Limited", | ||
"license": "AGPL-3", | ||
"website": "https://www.quartile.co", | ||
"depends": ["website_sale_stock",], | ||
"data": ["views/res_company_views.xml"], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import res_company | ||
from . import website |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2024 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = 'res.company' | ||
|
||
default_website_warehouse_id = fields.Many2one("stock.warehouse") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2024 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class Website(models.Model): | ||
_inherit = 'website' | ||
|
||
@api.multi | ||
def _prepare_sale_order_values(self, partner, pricelist): | ||
values = super(Website, self)._prepare_sale_order_values(partner, pricelist) | ||
if values['company_id']: | ||
warehouse = self.env['res.company'].browse(values['company_id']).default_website_warehouse_id | ||
if warehouse: | ||
values['warehouse_id'] = warehouse.id | ||
return values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module sets the default warehouse in a sale order originating from website sales. |
15 changes: 15 additions & 0 deletions
15
website_sale_default_warehouse/views/res_company_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="res_company_form_inherit" model="ir.ui.view"> | ||
<field name="name">res.company.form</field> | ||
<field name="model">res.company</field> | ||
<field name="inherit_id" ref="base.view_company_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//page[1]/group/group[2]" position="after"> | ||
<group> | ||
<field name="default_website_warehouse_id" /> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |