Skip to content

Commit

Permalink
[12.0][MIG] stock_orderpoint_uom
Browse files Browse the repository at this point in the history
:000000 100644 00000000 382f6de5 A	stock_orderpoint_uom/README.rst
:000000 100644 00000000 b52a76e1 A	stock_orderpoint_uom/__init__.py
:000000 100644 00000000 5903c8c8 A	stock_orderpoint_uom/__manifest__.py
:000000 100644 00000000 b6d25b51 A	stock_orderpoint_uom/i18n/stock_orderpoint_uom.pot
:000000 100644 00000000 128caa2a A	stock_orderpoint_uom/models/__init__.py
:000000 100644 00000000 325b8256 A	stock_orderpoint_uom/models/procurement_group.py
:000000 100644 00000000 12e097db A	stock_orderpoint_uom/models/product_template.py
:000000 100644 00000000 48ca6f9d A	stock_orderpoint_uom/models/stock_warehouse_orderpoint.py
:000000 100644 00000000 2ade2a17 A	stock_orderpoint_uom/readme/CONFIGURE.rst
:000000 100644 00000000 2e04b89a A	stock_orderpoint_uom/readme/CONTRIBUTORS.rst
:000000 100644 00000000 40508d5a A	stock_orderpoint_uom/readme/DESCRIPTION.rst
:000000 100644 00000000 a38d3e7d A	stock_orderpoint_uom/readme/USAGE.rst
:000000 100644 00000000 4ade4c68 A	stock_orderpoint_uom/static/description/index.html
:000000 100644 00000000 03937125 A	stock_orderpoint_uom/tests/__init__.py
:000000 100644 00000000 a62acb52 A	stock_orderpoint_uom/tests/test_stock_orderpoint_procure_uom.py
:000000 100644 00000000 d52bf56b A	stock_orderpoint_uom/views/stock_warehouse_orderpoint_view.xml
  • Loading branch information
kittiu committed Mar 20, 2019
1 parent 60f328d commit c3ce7bd
Show file tree
Hide file tree
Showing 16 changed files with 862 additions and 0 deletions.
94 changes: 94 additions & 0 deletions stock_orderpoint_uom/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
====================
Stock Orderpoint UoM
====================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_orderpoint_uom
:alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_orderpoint_uom
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/153/12.0
:alt: Try me on Runbot

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

This module allows users users to define what unit of measure should be used
in procurements created from minimum stock rules.

A typical use case would be a product that is stocked in centimeters, and
needs to be restocked in meters from another warehouse. When the picking is
created, the quantity to be transferred will be expressed in meters, making
it easier for the people responsible for the transfers to understand the
requirement.

**Table of contents**

.. contents::
:local:

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

To configure this module, you need to 'Inventory > Configuration > Settings'
and enable 'Sell and purchase products in different units of measure' option.

Usage
=====

Go to 'Inventory > Master Data > Reordering Rules' and indicate a Procurement UoM.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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-warehouse/issues/new?body=module:%20stock_orderpoint_uom%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
~~~~~~~

* Eficent

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

* Jordi Ballester Alomar <jordi.ballester@eficent.com>
* Lois Rilo <lois.rilo@eficent.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>

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-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_orderpoint_uom>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions stock_orderpoint_uom/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
18 changes: 18 additions & 0 deletions stock_orderpoint_uom/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Orderpoint UoM",
"summary": "Allows to create procurement orders in the UoM indicated in "
"the orderpoint",
"version": "12.0.1.0.0",
"author": "Eficent, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"depends": ["purchase", "stock"],
"data": ["views/stock_warehouse_orderpoint_view.xml"],
"license": "AGPL-3",
'installable': True,
'application': False,
}
49 changes: 49 additions & 0 deletions stock_orderpoint_uom/i18n/stock_orderpoint_uom.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_orderpoint_uom
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-16 07:17+0000\n"
"PO-Revision-Date: 2019-03-16 07:17+0000\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: stock_orderpoint_uom
#: code:addons/stock_orderpoint_uom/models/product_template.py:21
#, python-format
msgid "At least one reordering rule for this product has a different Procurement unit of measure category."
msgstr ""

#. module: stock_orderpoint_uom
#: code:addons/stock_orderpoint_uom/models/stock_warehouse_orderpoint.py:23
#, python-format
msgid "Error: The product default Unit of Measure and the procurement Unit of Measure must be in the same category."
msgstr ""

#. module: stock_orderpoint_uom
#: model:ir.model,name:stock_orderpoint_uom.model_stock_warehouse_orderpoint
msgid "Minimum Inventory Rule"
msgstr ""

#. module: stock_orderpoint_uom
#: model:ir.model,name:stock_orderpoint_uom.model_procurement_group
msgid "Procurement Group"
msgstr ""

#. module: stock_orderpoint_uom
#: model:ir.model.fields,field_description:stock_orderpoint_uom.field_stock_warehouse_orderpoint__procure_uom_id
msgid "Procurement UoM"
msgstr ""

#. module: stock_orderpoint_uom
#: model:ir.model,name:stock_orderpoint_uom.model_product_template
msgid "Product Template"
msgstr ""

5 changes: 5 additions & 0 deletions stock_orderpoint_uom/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import stock_warehouse_orderpoint
from . import product_template
from . import procurement_group
23 changes: 23 additions & 0 deletions stock_orderpoint_uom/models/procurement_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# (http://www.opensourceintegrators.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, models


class ProcurementGroup(models.Model):
_inherit = "procurement.group"

@api.model
def run(self, product_id, product_qty, product_uom, location_id, name,
origin, values):
if 'orderpoint_id' in values:
orderpoint = values.get('orderpoint_id')
if orderpoint.procure_uom_id and \
product_uom != orderpoint.procure_uom_id:
product_qty = product_uom._compute_quantity(
product_qty, orderpoint.procure_uom_id)
product_uom = orderpoint.procure_uom_id
return super(ProcurementGroup, self).run(product_id, product_qty,
product_uom, location_id,
name, origin, values)
22 changes: 22 additions & 0 deletions stock_orderpoint_uom/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, models, _
from odoo.exceptions import UserError


class ProductTemplate(models.Model):
_inherit = "product.template"

@api.constrains('uom_id')
def _check_orderpoint_procure_uom(self):
for rec in self:
orderpoint = self.env['stock.warehouse.orderpoint'].search([
('procure_uom_id.category_id', '!=',
rec.uom_id.category_id.id),
('product_id', 'in', rec.product_variant_ids.ids)], limit=1)
if orderpoint:
raise UserError(
_("At least one reordering rule for this product has a "
"different Procurement unit of measure category."))
26 changes: 26 additions & 0 deletions stock_orderpoint_uom/models/stock_warehouse_orderpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models, _
from odoo.exceptions import UserError


class Orderpoint(models.Model):
_inherit = "stock.warehouse.orderpoint"

procure_uom_id = fields.Many2one(comodel_name='uom.uom',
string="Procurement UoM")

@api.constrains('product_id', 'procure_uom_id')
def _check_procure_uom(self):
if any(orderpoint.product_uom and
orderpoint.procure_uom_id and
orderpoint.product_uom.category_id !=
orderpoint.procure_uom_id.category_id
for orderpoint in self):
raise UserError(
_('Error: The product default Unit of Measure and '
'the procurement Unit of Measure must be in the '
'same category.'))
return True
2 changes: 2 additions & 0 deletions stock_orderpoint_uom/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To configure this module, you need to 'Inventory > Configuration > Settings'
and enable 'Sell and purchase products in different units of measure' option.
4 changes: 4 additions & 0 deletions stock_orderpoint_uom/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
* Lois Rilo <lois.rilo@eficent.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
8 changes: 8 additions & 0 deletions stock_orderpoint_uom/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This module allows users users to define what unit of measure should be used
in procurements created from minimum stock rules.

A typical use case would be a product that is stocked in centimeters, and
needs to be restocked in meters from another warehouse. When the picking is
created, the quantity to be transferred will be expressed in meters, making
it easier for the people responsible for the transfers to understand the
requirement.
1 change: 1 addition & 0 deletions stock_orderpoint_uom/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Go to 'Inventory > Master Data > Reordering Rules' and indicate a Procurement UoM.
Loading

0 comments on commit c3ce7bd

Please sign in to comment.