Skip to content

Commit

Permalink
Merge PR OCA#629 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Mar 25, 2020
2 parents 40ef38f + 39d7a92 commit d624230
Show file tree
Hide file tree
Showing 16 changed files with 757 additions and 0 deletions.
93 changes: 93 additions & 0 deletions sale_order_global_stock_route/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
=============================
Sale Order Global Stock Route
=============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/12.0/sale_order_global_stock_route
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-12-0/stock-logistics-workflow-12-0-sale_order_global_stock_route
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/154/12.0
:alt: Try me on Runbot

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

This module adds the possibility to apply a general route on a quotation.

**Table of contents**

.. contents::
:local:

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

For use this module you have to activate the option Settings > Inventory
> Warehouse > Multi-Step Routes

In the user profile you must select this option "Enable Route on
Sales Order Line"

Usage
=====

To use this module, you simply need to:

#. Create a new quotation.
#. Add the products that you need.
#. Change the form route option.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20sale_order_global_stock_route%0Aversion:%2012.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
~~~~~~~

* Tecnativa

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

* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Roca (Tecnativa) carlos.roca@tecnativa.com

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/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/12.0/sale_order_global_stock_route>`_ 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_global_stock_route/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions sale_order_global_stock_route/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2020 Tecnativa - Carlos Roca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Sale Order Global Stock Route',
'summary': 'Add the possibility to choose '
'one warehouse path for an order',
'version': '12.0.1.0.0',
'development_status': 'Beta',
'category': 'Warehouse',
'website': 'https://github.com/OCA/stock-logistics-warehouse',
'author': 'Tecnativa, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'installable': True,
'depends': [
'sale_stock',
],
'data': [
'views/sale_order_views.xml',
],
}
24 changes: 24 additions & 0 deletions sale_order_global_stock_route/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_global_stock_route
#
# Translators:
# Carlos Roca <carlos.roca@tecnativa.com>, 2020
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-02-24 10:00+0000\n"
"PO-Revision-Date: 2020-02-24 10:00+0000\n"
"Last-Translator: Carlos Roca <carlos.roca@tecnativa.com>, 2020\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: sale_order_global_stock_route
#: model:ir.model.fields,field_description:sale_order_global_stock_route.field_sale_order__route_id
msgid "Route"
msgstr "Ruta"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_global_stock_route
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Carlos Roca <carlos.roca@tecnativa.com>, 2020\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_order_global_stock_route
#: model:ir.model.fields,field_description:sale_order_global_stock_route.field_sale_order__route_id
msgid "Route"
msgstr ""
1 change: 1 addition & 0 deletions sale_order_global_stock_route/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
47 changes: 47 additions & 0 deletions sale_order_global_stock_route/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2020 Tecnativa - Carlos Roca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models, api
from lxml import etree


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

route_id = fields.Many2one(
comodel_name='stock.location.route',
string='Route',
domain=[('sale_selectable', '=', True)],
help='When you change this field all the lines will be changed.'
' After use it you will be able to change each line.',
)

@api.onchange('route_id')
def _onchange_route_id(self):
for line in self.order_line:
line.route_id = line.order_id.route_id

@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
submenu=False):
"""The purpose of this is to write a context on "order_line" field
respecting other contexts on this field.
There is a PR (https://github.com/odoo/odoo/pull/26607) to odoo for
avoiding this. If merged, remove this method and add the attribute
in the field.
"""
res = super(SaleOrder, self).fields_view_get(
view_id=view_id, view_type=view_type, toolbar=toolbar,
submenu=submenu,
)
if view_type == 'form':
order_xml = etree.XML(res['arch'])
order_line_fields = order_xml.xpath("//field[@name='order_line']")
if order_line_fields:
order_line_field = order_line_fields[0]
context = order_line_field.attrib.get("context", "{}").replace(
"{", "{'default_route_id': route_id, ", 1,
)
order_line_field.attrib['context'] = context
res['arch'] = etree.tostring(order_xml)
return res
5 changes: 5 additions & 0 deletions sale_order_global_stock_route/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
For use this module you have to activate the option Settings > Inventory
> Warehouse > Multi-Step Routes

In the user profile you must select this option "Enable Route on
Sales Order Line"
3 changes: 3 additions & 0 deletions sale_order_global_stock_route/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Roca (Tecnativa) carlos.roca@tecnativa.com
1 change: 1 addition & 0 deletions sale_order_global_stock_route/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds the possibility to apply a general route on a quotation.
5 changes: 5 additions & 0 deletions sale_order_global_stock_route/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you simply need to:

#. Create a new quotation.
#. Add the products that you need.
#. Change the form route option.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d624230

Please sign in to comment.