[MIG] mrp_warehouse_calendar: Migration to 12.0

This commit is contained in:
Saran L
2018-08-05 17:15:59 +02:00
committed by davidborromeo
parent 264416dd3e
commit cb3f8109a9
7 changed files with 43 additions and 18 deletions

View File

@@ -23,7 +23,7 @@ MRP Warehouse Calendar
:target: https://runbot.odoo-community.org/runbot/129/11.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|
With this module the manufacturing orders created from procurements consider
the calendar assigned to the warehouse of the picking type of the
@@ -103,9 +103,9 @@ promote its widespread use.
:target: https://github.com/jbeficent
:alt: jbeficent
Current `maintainer <https://odoo-community.org/page/maintainer-role>`_:
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-jbeficent|
|maintainer-jbeficent|
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/11.0/mrp_warehouse_calendar>`_ project on GitHub.

View File

@@ -4,7 +4,7 @@
{
"name": "MRP Warehouse Calendar",
"summary": "Considers the warehouse calendars in manufacturing",
"version": "11.0.1.0.0",
"version": "12.0.1.0.0",
"license": "AGPL-3",
"website": "https://github.com/stock-logistics-warehouse",
"author": "Eficent, "

View File

@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_warehouse_calendar
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2018-12-09 10:43+0000\n"
"Last-Translator: Maria Sparenberg <maria.sparenberg@gmx.net>\n"
"Language-Team: none\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.3\n"
#. module: mrp_warehouse_calendar
#: model:ir.model,name:mrp_warehouse_calendar.model_mrp_production
msgid "Manufacturing Order"
msgstr "Fertigungsauftrag"
#. module: mrp_warehouse_calendar
#: model:ir.model,name:mrp_warehouse_calendar.model_procurement_rule
msgid "Procurement Rule"
msgstr "Beschaffungsregel"

View File

@@ -1,2 +1,2 @@
from . import mrp_production
from . import procurement_rule
from . import stock_rule

View File

@@ -1,7 +1,7 @@
# Copyright 2018 Eficent Business and IT Consulting Services, S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
from odoo import api, models
class MrpProduction(models.Model):
@@ -9,7 +9,7 @@ class MrpProduction(models.Model):
@api.onchange('date_planned_start', 'product_id')
def onchange_date_planned(self):
dt_planned = fields.Datetime.from_string(self.date_planned_start)
dt_planned = self.date_planned_start
warehouse = self.picking_type_id.warehouse_id
if warehouse.calendar_id and self.product_id.produce_delay:
date_expected_finished = warehouse.calendar_id.plan_days(
@@ -19,7 +19,7 @@ class MrpProduction(models.Model):
@api.multi
def copy(self, default=None):
mo = super(MrpProduction, self).copy(default=default)
dt_planned = fields.Datetime.from_string(mo.date_planned_start)
dt_planned = mo.date_planned_start
warehouse = mo.picking_type_id.warehouse_id
if warehouse.calendar_id and mo.product_id.produce_delay:
date_expected = warehouse.calendar_id.plan_days(

View File

@@ -4,15 +4,15 @@
from odoo import fields, models
class ProcurementRule(models.Model):
_inherit = 'procurement.rule'
class StockRule(models.Model):
_inherit = 'stock.rule'
def _get_date_planned(self, product_id, values):
date_planned = super(ProcurementRule, self)._get_date_planned(
date_planned = super(StockRule, self)._get_date_planned(
product_id, values)
picking_type = self.picking_type_id or \
values['warehouse_id'].manu_type_id
dt_planned = fields.Datetime.from_string(values['date_planned'])
dt_planned = fields.Datetime.to_datetime(values['date_planned'])
warehouse = picking_type.warehouse_id
if warehouse.calendar_id and product_id.produce_delay:
lead_days = values['company_id'].manufacturing_lead + \

View File

@@ -64,10 +64,9 @@ class TestMrpWarehouseCalendar(TransactionCase):
'Test', values)
mo = self.env['mrp.production'].search(
[('product_id', '=', self.product.id)], limit=1)
date_plan_start = fields.Datetime.from_string(
mo.date_planned_start).date()
date_plan_start = fields.Date.to_date(mo.date_planned_start)
# Friday 4th Jan 2097
friday = fields.Datetime.from_string('2097-01-04 09:00:00').date()
friday = fields.Date.to_date('2097-01-04 09:00:00')
self.assertEqual(date_plan_start, friday)
@@ -81,7 +80,6 @@ class TestMrpWarehouseCalendar(TransactionCase):
})
mo.date_planned_start = '2097-01-04 09:00:00'
mo.onchange_date_planned()
date_plan_finished = fields.Datetime.from_string(
mo.date_planned_finished).date()
monday = fields.Datetime.from_string('2097-01-07 09:00:00').date()
date_plan_finished = fields.Date.to_date(mo.date_planned_finished)
monday = fields.Date.to_date('2097-01-07 09:00:00')
self.assertEqual(date_plan_finished, monday)