rename module

This commit is contained in:
jbeficent
2016-10-24 18:32:54 +02:00
committed by lreficent
parent ed8096a798
commit 2f9bfa8088
9 changed files with 221 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
====================
Stock Orderpoint UoM
====================
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.
Usage
=====
Go to 'Configuration / Reordering Rules' and indicate a Procurement UoM.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/153/8.0
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.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
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.
To contribute to this module, please visit https://odoo-community.org.

View File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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": "8.0.1.0.0",
"author": "Eficent Business and IT Consulting Services S.L,"
"Odoo Community Association (OCA)",
"website": "https://www.odoo-community.org",
"category": "Warehouse Management",
"depends": ["stock"],
"data": ["views/stock_warehouse_orderpoint_view.xml"],
"license": "AGPL-3",
'installable': True,
'application': True,
}

View File

@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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 stock_warehouse_orderpoint
from . import procurement_order

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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 openerp import api, models
class ProcurementOrder(models.Model):
_inherit = "procurement.order"
@api.multi
@api.onchange('product_id')
def onchange_product_id(self):
for rec in self:
rec.procure_uom_id = rec.product_id.uom_id
@api.model
def _prepare_orderpoint_procurement(self, orderpoint, product_qty):
res = super(ProcurementOrder,self)._prepare_orderpoint_procurement(
orderpoint, product_qty)
if orderpoint.procure_uom_id:
res['product_qty'] = orderpoint.procure_uom_id._compute_qty(
orderpoint.product_id.uom_id.id, product_qty,
orderpoint.procure_uom_id.id)
res['product_uom'] = orderpoint.procure_uom_id.id
return res

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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 openerp import api, fields, models
class StockWarehouseOrderpoint(models.Model):
_inherit = "stock.warehouse.orderpoint"
procure_uom_id = fields.Many2one(comodel_name='product.uom',
string="Procurement UoM")
@api.multi
@api.onchange('product_id')
def onchange_product_id(self):
for rec in self:
rec.procure_uom_id = rec.product_id.uom_id

View File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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 test_stock_orderpoint_procure_uom

View File

@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
# Copyright 2016 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).
import openerp.tests.common as common
class TestStockOrderpointProcureUom(common.TransactionCase):
def test_stock_orderpoont_procure_uom(self):
super(TestStockOrderpointProcureUom, self).setUp()
productObj = self.env['product.product']
warehouse = self.env.ref('stock.warehouse0')
location_stock = self.env.ref('stock.stock_location_stock')
uom_unit = self.env.ref('product.product_uom_unit')
uom_dozen = self.env.ref('product.product_uom_dozen')
self.company_partner = self.env.ref('base.main_partner')
productA = productObj.create(
{'name': 'product A',
'standard_price': 1,
'type': 'product',
'uom_id': uom_unit.id,
'default_code': 'A',
})
self.env['stock.warehouse.orderpoint'].create({
'warehouse_id': warehouse.id,
'location_id': location_stock.id,
'product_id': productA.id,
'product_max_qty': 24,
'product_min_qty': 12,
'procure_uom_id': uom_dozen.id,
})
sched = self.env['procurement.order']
sched.run_scheduler()
proc = sched.search([('product_id', '=', productA.id)])
self.assertEqual(proc.product_uom, uom_dozen)
self.assertEqual(proc.product_qty, 2)

View File

@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_warehouse_orderpoint_tree" model="ir.ui.view">
<field name="name">stock.warehouse.orderpoint.tree</field>
<field name="model">stock.warehouse.orderpoint</field>
<field name="inherit_id"
ref="stock.view_warehouse_orderpoint_tree"/>
<field name="arch" type="xml">
<field name="product_uom" position="after">
<field name="procure_uom_id" groups="product.group_uom"/>
</field>
</field>
</record>
<record id="view_warehouse_orderpoint_form" model="ir.ui.view">
<field name="name">stock.warehouse.orderpoint.form</field>
<field name="model">stock.warehouse.orderpoint</field>
<field name="inherit_id"
ref="stock.view_warehouse_orderpoint_form"/>
<field name="arch" type="xml">
<field name="product_uom" position="after">
<field name="procure_uom_id" class="oe_inline"
groups="product.group_uom"/>
</field>
</field>
</record>
</data>
</openerp>