Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] sale_order_warehouse_from_delivery_carrier #684

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions sale_order_warehouse_from_delivery_carrier/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
==========================================
Sale Order Warehouse from Delivery Carrier
==========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e8f481a264c8661719b37031c573b70ab66023d43f2744604bc29f6b6a07a10c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdelivery--carrier-lightgray.png?logo=github
:target: https://github.com/OCA/delivery-carrier/tree/16.0/sale_order_warehouse_from_delivery_carrier
:alt: OCA/delivery-carrier
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/delivery-carrier-16-0/delivery-carrier-16-0-sale_order_warehouse_from_delivery_carrier
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/delivery-carrier&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to set warehouse in Sales Order based on selected shipping method.

**Table of contents**

.. contents::
:local:

Configuration
=============

Go to `Sales` -> `Settings` -> `Shipping methods` and select a shipping method

Set warehouse in the "Sales Order Warehouse" field.

Usage
=====

Create a new quotation and select a shipping method.

If selected shipping method has a sales order warehouse defined
this warehouse will be automatically set in the quotation.

**Note**:
The warehouse will NOT be updated if the sales order is already confirmed.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/delivery-carrier/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/delivery-carrier/issues/new?body=module:%20sale_order_warehouse_from_delivery_carrier%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Cetmix

Contributors
~~~~~~~~~~~~

* Cetmix <cetmix.com>

* Ivan Sokolov
* Maksim Shurupov

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/delivery-carrier <https://github.com/OCA/delivery-carrier/tree/16.0/sale_order_warehouse_from_delivery_carrier>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_order_warehouse_from_delivery_carrier/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions sale_order_warehouse_from_delivery_carrier/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Sale Order Warehouse from Delivery Carrier",
"version": "16.0.1.0.0",
"category": "Delivery",
"summary": "Sale Order WH from Delivery Carrier",
"depends": ["sale_stock", "delivery"],
"website": "https://github.com/OCA/delivery-carrier",
"author": "Cetmix, Odoo Community Association (OCA)",
"data": [
"views/delivery_carrier_views.xml",
],
"installable": True,
"license": "AGPL-3",
}
2 changes: 2 additions & 0 deletions sale_order_warehouse_from_delivery_carrier/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import delivery_carrier
from . import sale_order
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from odoo import fields, models


class DeliveryCarrier(models.Model):
_inherit = "delivery.carrier"

so_warehouse_id = fields.Many2one(
comodel_name="stock.warehouse",
string="Sales Order Warehouse",
help="Default warehouse for the sales order that uses this delivery carrier",
)
19 changes: 19 additions & 0 deletions sale_order_warehouse_from_delivery_carrier/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from odoo import api, models


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

@api.depends("user_id", "company_id", "carrier_id")
def _compute_warehouse_id(self):
# Set warehouse by shipping method
so_with_shipping = self.browse()
for order in self:
if (
order.state == "draft"
and order.carrier_id
and order.carrier_id.so_warehouse_id
):
order.warehouse_id = order.carrier_id.so_warehouse_id
so_with_shipping |= order
return super(SaleOrder, self - so_with_shipping)._compute_warehouse_id()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Go to `Sales` -> `Settings` -> `Shipping methods` and select a shipping method

Set warehouse in the "Sales Order Warehouse" field.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Cetmix <cetmix.com>

* Ivan Sokolov
* Maksim Shurupov
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows to set warehouse in Sales Order based on selected shipping method.
7 changes: 7 additions & 0 deletions sale_order_warehouse_from_delivery_carrier/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Create a new quotation and select a shipping method.

If selected shipping method has a sales order warehouse defined
this warehouse will be automatically set in the quotation.

**Note**:
The warehouse will NOT be updated if the sales order is already confirmed.
Loading
Loading