[MIG] stock_orderpoint_uom to v10.0

This commit is contained in:
lreficent
2017-03-16 10:06:40 +01:00
committed by davidborromeo
parent d8e6446cf5
commit 69566d8507
8 changed files with 27 additions and 37 deletions

View File

@@ -31,7 +31,7 @@ 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
:target: https://runbot.odoo-community.org/runbot/153/10.0
Bug Tracker
===========
@@ -53,6 +53,7 @@ Contributors
------------
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
* Lois Rilo <lois.rilo@eficent.com>
Maintainer

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# 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).

View File

@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# 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": "9.0.1.0.0",
"author": "Eficent Business and IT Consulting Services S.L,"
"version": "10.0.1.0.0",
"author": "Eficent, "
"Odoo Community Association (OCA)",
"website": "https://www.odoo-community.org",
"category": "Warehouse Management",

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# 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 stock_warehouse_orderpoint
from . import procurement_order

View File

@@ -1,21 +0,0 @@
# -*- 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.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

@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# 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 openerp import api, fields, models, _
from openerp.exceptions import UserError
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class StockWarehouseOrderpoint(models.Model):
class Orderpoint(models.Model):
_inherit = "stock.warehouse.orderpoint"
procure_uom_id = fields.Many2one(comodel_name='product.uom',
@@ -25,3 +25,14 @@ class StockWarehouseOrderpoint(models.Model):
'the procurement Unit of Measure must be in the '
'same category.'))
return True
@api.model
def _prepare_procurement_values(self, product_qty,
date=False, group=False):
res = super(Orderpoint, self)._prepare_procurement_values(
product_qty, date, group)
if self.procure_uom_id:
res['product_qty'] = self.product_uom._compute_quantity(
product_qty, self.procure_uom_id)
res['product_uom'] = self.procure_uom_id.id
return res

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# 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).

View File

@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# 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).
import openerp.tests.common as common
from openerp.tools import mute_logger
from openerp.exceptions import ValidationError
import odoo.tests.common as common
from odoo.tools import mute_logger
from odoo.exceptions import ValidationError
class TestStockOrderpointProcureUom(common.TransactionCase):