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

[15.0][MIG] edi_voxel_sale_secondary_unit: Migration to version 15.0 #680

Closed
Closed
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
103 changes: 103 additions & 0 deletions edi_voxel_sale_secondary_unit_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
=================================
Edi Voxel Sale Secondary Unit Oca
=================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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%2Fedi-lightgray.png?logo=github
:target: https://github.com/OCA/edi/tree/15.0/edi_voxel_sale_secondary_unit_oca
:alt: OCA/edi
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/edi-15-0/edi-15-0-edi_voxel_sale_secondary_unit_oca
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/226/15.0
:alt: Try me on Runbot

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

This module extends the functionality of 'Voxel sale order' module
to match secondary units of measure instead of standard units of measure
during sale order import process.

During the process of a sales order import from voxel, for each sales
order line, the following flow is followed:

* If there is a matching 'secondary unit of measure', this is set and
the imported qty is set as 'secondary qty'. Based on these data, the
standard 'unit of measure' and 'quantity' are computed.
* If there is no matching 'secondary unit of measure', standard quantity
and the matching standard unit of measure are set.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you don't need to do anything. The import process is
the same as in the 'Voxel sale order' module. the only thing that can
change is the imported sales order data.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi/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/edi/issues/new?body=module:%20edi_voxel_sale_secondary_unit_oca%0Aversion:%2015.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>`_:

* Ernesto Tejeda
* Pedro M. Baeza
* Sergio Teruel

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.

.. |maintainer-ernestotejeda| image:: https://github.com/ernestotejeda.png?size=40px
:target: https://github.com/ernestotejeda
:alt: ernestotejeda

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ernestotejeda|

This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/15.0/edi_voxel_sale_secondary_unit_oca>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions edi_voxel_sale_secondary_unit_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
18 changes: 18 additions & 0 deletions edi_voxel_sale_secondary_unit_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2021 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Edi Voxel Sale Secondary Unit Oca",
"summary": "Map Voxel UoM to Sale Secondary UoM and Use Them",
"version": "15.0.1.0.0",
"development_status": "Production/Stable",
"category": "Sale",
"website": "https://github.com/OCA/edi",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["ernestotejeda"],
"license": "AGPL-3",
"depends": [
"edi_voxel_secondary_unit_oca",
"sale_order_secondary_unit",
"edi_voxel_sale_order_import_oca",
],
}
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:
# * edi_voxel_sale_secondary_unit_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \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: edi_voxel_sale_secondary_unit_oca
#: model:ir.model,name:edi_voxel_sale_secondary_unit_oca.model_sale_order
msgid "Sales Order"
msgstr ""
3 changes: 3 additions & 0 deletions edi_voxel_sale_secondary_unit_oca/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import sale_order
23 changes: 23 additions & 0 deletions edi_voxel_sale_secondary_unit_oca/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2021 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


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

def _parse_qty_uom_voxel(self, line_vals, line_element):
"""Override to use secondary unit instead standard UoM"""
product_data = line_element.attrib
product_id = line_vals.get("product_id")
product = self.env["product.product"].browse(product_id)
qty = float(product_data.get("Qty", "1"))
mu = product_data.get("MU")
secondary_uom = product.secondary_uom_ids.filtered(lambda r: r.voxel_code == mu)
if secondary_uom:
line_vals.update(
secondary_uom_qty=qty, secondary_uom_id=secondary_uom[0].id
)
else:
return super()._parse_qty_uom_voxel(line_vals, line_element)
5 changes: 5 additions & 0 deletions edi_voxel_sale_secondary_unit_oca/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Ernesto Tejeda
* Pedro M. Baeza
* Sergio Teruel
12 changes: 12 additions & 0 deletions edi_voxel_sale_secondary_unit_oca/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This module extends the functionality of 'Voxel sale order' module
to match secondary units of measure instead of standard units of measure
during sale order import process.

During the process of a sales order import from voxel, for each sales
order line, the following flow is followed:

* If there is a matching 'secondary unit of measure', this is set and
the imported qty is set as 'secondary qty'. Based on these data, the
standard 'unit of measure' and 'quantity' are computed.
* If there is no matching 'secondary unit of measure', standard quantity
and the matching standard unit of measure are set.
3 changes: 3 additions & 0 deletions edi_voxel_sale_secondary_unit_oca/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To use this module, you don't need to do anything. The import process is
the same as in the 'Voxel sale order' module. the only thing that can
change is the imported sales order data.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading