mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] mrp_production_grouped_by_product: Migration to 12.0
This commit is contained in:
committed by
Lois Rilo
parent
72e375d9a5
commit
3feba8f821
@@ -1,10 +1,11 @@
|
||||
# Copyright 2018 Tecnativa - David Vidal
|
||||
# Copyright 2018 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2019 Rubén Bravo <rubenred18@gmail.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Production Grouped By Product',
|
||||
'version': '11.0.1.0.0',
|
||||
'version': '12.0.1.0.0',
|
||||
'category': 'MRP',
|
||||
'author': 'Tecnativa, '
|
||||
'Odoo Community Association (OCA)',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
from . import mrp_production
|
||||
from . import procurement
|
||||
from . import stock_rule
|
||||
from . import stock_picking_type
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProcurementRule(models.Model):
|
||||
_inherit = 'procurement.rule'
|
||||
class StockRule(models.Model):
|
||||
_inherit = 'stock.rule'
|
||||
|
||||
def _run_manufacture(self, product_id, product_qty, product_uom,
|
||||
location_id, name, origin, values):
|
||||
return super(
|
||||
ProcurementRule, self.with_context(group_mo_by_product=True),
|
||||
StockRule, self.with_context(group_mo_by_product=True),
|
||||
)._run_manufacture(
|
||||
product_id, product_qty, product_uom, location_id, name, origin,
|
||||
values,
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright 2018 Tecnativa - David Vidal
|
||||
# Copyright 2018 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2019 Rubén Bravo <rubenred18@gmail.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import exceptions
|
||||
@@ -17,7 +18,11 @@ class TestProductionGroupedByProduct(common.SavepointCase):
|
||||
cls.MrpProduction = cls.env['mrp.production']
|
||||
cls.env.user.company_id.manufacturing_lead = 0
|
||||
cls.env.user.tz = False # Make sure there's no timezone in user
|
||||
cls.picking_type = cls.env.ref('mrp.picking_type_manufacturing')
|
||||
|
||||
cls.picking_type = cls.env['stock.picking.type'].search([
|
||||
('code', '=', 'mrp_operation'),
|
||||
('sequence_id.company_id', '=', cls.env.user.company_id.id)
|
||||
], limit=1)
|
||||
cls.product1 = cls.env['product.product'].create({
|
||||
'name': 'TEST Muffin',
|
||||
'route_ids': [(6, 0, [
|
||||
@@ -95,11 +100,13 @@ class TestProductionGroupedByProduct(common.SavepointCase):
|
||||
self.assertEqual(len(mo), 2)
|
||||
|
||||
def test_check_mo_grouping_max_hour(self):
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.picking_type.mo_grouping_max_hour = 25
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.picking_type.mo_grouping_max_hour = -1
|
||||
if self.picking_type:
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.picking_type.mo_grouping_max_hour = 25
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.picking_type.mo_grouping_max_hour = -1
|
||||
|
||||
def test_check_mo_grouping_interval(self):
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.picking_type.mo_grouping_interval = -1
|
||||
if self.picking_type:
|
||||
with self.assertRaises(exceptions.ValidationError):
|
||||
self.picking_type.mo_grouping_interval = -1
|
||||
|
||||
Reference in New Issue
Block a user