[MIG] stock_vertical_lift{,_kardex}: Migration to 13.0

This commit is contained in:
Guewen Baconnier
2019-12-16 15:52:03 +01:00
parent e6733ddf73
commit b574c829c1
13 changed files with 22 additions and 28 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "Vertical Lift",
"summary": "Provides the core for integration with Vertical Lifts",
"version": "12.0.1.0.0",
"version": "13.0.1.0.0",
"category": "Stock",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",

View File

@@ -13,7 +13,6 @@
<field name="tracking">none</field>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="property_stock_inventory" ref="stock.location_inventory"/>
</record>
<record id="product_recovery_socks" model="product.product">
@@ -28,7 +27,6 @@
<field name="tracking">none</field>
<field name="uom_id" ref="uom.product_uom_unit"/>
<field name="uom_po_id" ref="uom.product_uom_unit"/>
<field name="property_stock_inventory" ref="stock.location_inventory"/>
</record>
</odoo>

View File

@@ -13,8 +13,11 @@
<field name="location_id" ref="stock_location_vertical_lift_demo_tray_1b_x3y2"/>
</record>
<function model="stock.inventory" name="action_validate">
<function model="stock.inventory" name="_action_start">
<function eval="[[('state','=','draft'),('id', '=', ref('stock_vertical_lift.stock_inventory_vertical_lift_0'))]]" model="stock.inventory" name="search"/>
</function>
<function model="stock.inventory" name="action_validate">
<function eval="[[('state','=','confirm'),('id', '=', ref('stock_vertical_lift.stock_inventory_vertical_lift_0'))]]" model="stock.inventory" name="search"/>
</function>
</odoo>

View File

@@ -11,7 +11,6 @@
<field name="location_id" ref="stock.stock_location_stock"/>
<field name="usage">internal</field>
<field name="vertical_lift_location" eval="True"/>
<field name="company_id"></field>
</record>
<record id="stock_location_vertical_lift_demo_shuttle_1" model="stock.location">

View File

@@ -47,9 +47,8 @@ class StockLocation(models.Model):
if location.vertical_lift_location:
location.vertical_lift_kind = "view"
continue
kind = tree.get(location.location_id.vertical_lift_kind)
if kind:
location.vertical_lift_kind = kind
kind = tree.get(location.location_id.vertical_lift_kind, False)
location.vertical_lift_kind = kind
@api.depends(
"inverse_vertical_lift_shuttle_ids", "location_id.vertical_lift_shuttle_id"
@@ -66,8 +65,7 @@ class StockLocation(models.Model):
def _hardware_vertical_lift_tray(self, cell_location=None):
payload = self._hardware_vertical_lift_tray_payload(cell_location)
res = self.vertical_lift_shuttle_id._hardware_send_message(payload)
return res
return self.vertical_lift_shuttle_id._hardware_send_message(payload)
def _hardware_vertical_lift_tray_payload(self, cell_location=None):
"""Prepare the message to be sent to the vertical lift hardware
@@ -104,6 +102,9 @@ class StockLocation(models.Model):
position of the cell in mm from the bottom-left of a tray. (distance
from left, distance from bottom). Can be used for instance for
highlighting the cell using a laser pointer.
Returns a message in bytes, that will be sent through
``VerticalLiftShuttle._hardware_send_message()``.
"""
if self.vertical_lift_shuttle_id.hardware == "simulation":
message = _("Opening tray {}.").format(self.name)
@@ -112,7 +113,7 @@ class StockLocation(models.Model):
message += _("<br/>Laser pointer on x{} y{} ({}mm, {}mm)").format(
cell_location.posx, cell_location.posy, from_left, from_bottom
)
return message
return message.encode("utf-8")
else:
raise NotImplementedError()

View File

@@ -1,13 +1,12 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
from odoo import models
class StockMove(models.Model):
_inherit = "stock.move"
@api.multi
def write(self, vals):
result = super().write(vals)
if "state" in vals:

View File

@@ -12,17 +12,17 @@ class VerticalLiftCommand(models.Model):
_order = "shuttle_id, name desc"
_description = "commands sent to the shuttle"
@api.model
def _default_name(self):
return self.env["ir.sequence"].next_by_code("vertical.lift.command")
name = fields.Char("Name", default=_default_name, required=True, index=True)
name = fields.Char(
"Name", default=lambda s: s._default_name(), required=True, index=True
)
command = fields.Char(required=True)
answer = fields.Char()
error = fields.Char()
shuttle_id = fields.Many2one("vertical.lift.shuttle", required=True)
@api.model
def record_answer(self, answer):
name = self._get_key(answer)
record = self.search([("name", "=", name)], limit=1)
@@ -34,11 +34,10 @@ class VerticalLiftCommand(models.Model):
return record
def _get_key(self, answer):
key = answer.split("|")[1]
key = answer.split("|")[1:2]
return key
@api.model_create_multi
@api.returns("self", lambda value: value.id)
def create(self, vals_list):
for values in vals_list:
if "name" not in values:

View File

@@ -4,7 +4,7 @@ import logging
import socket
import ssl
from odoo import _, api, fields, models
from odoo import _, fields, models
_logger = logging.getLogger(__name__)
@@ -49,7 +49,6 @@ class VerticalLiftShuttle(models.Model):
)
]
@api.model
def _selection_hardware(self):
return [("simulation", "Simulation")]
@@ -161,7 +160,7 @@ class VerticalLiftShuttle(models.Model):
"res_id": operation.id,
"target": "fullscreen",
"flags": {
"headless": True,
"withControlPanel": False,
"form_view_initial_mode": "edit",
"no_breadcrumbs": True,
},
@@ -222,7 +221,6 @@ class VerticalLiftShuttleManualBarcode(models.TransientModel):
barcode = fields.Char(string="Barcode")
@api.multi
def button_save(self):
active_id = self.env.context.get("active_id")
model = self.env.context.get("active_model")

View File

@@ -116,7 +116,6 @@ class VerticalLiftCase(common.LocationTrayTypeCase):
"""
values = {
"name": "Test Inventory",
"filter": "partial",
"line_ids": [
(
0,

View File

@@ -2,7 +2,7 @@
<odoo>
<record id="view_stock_move_line_operation_tree" model="ir.ui.view">
<field name="name">stock.move.line.operations.tree.tray.type</field>
<field name="name">stock.move.line.operations.tree.vertical.lift</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock_location_tray.view_stock_move_line_operation_tree" />
<field name="arch" type="xml">

View File

@@ -155,7 +155,6 @@
<field name="name">Vertical Lift Shuttles</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">vertical.lift.shuttle</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="target">current</field>
<field name="domain">[]</field>

View File

@@ -3,7 +3,7 @@
{
"name": "Vertical Lift - Kardex",
"summary": "Integrate with Kardex Remstar Vertical Lifts",
"version": "12.0.1.0.0",
"version": "13.0.1.0.0",
"category": "Stock",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",

View File

@@ -1,7 +1,7 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
from odoo import models
JMIF_STATUS = {
0: "success",
@@ -24,7 +24,6 @@ JMIF_STATUS = {
class VerticalLiftShuttle(models.Model):
_inherit = "vertical.lift.shuttle"
@api.model
def _selection_hardware(self):
values = super()._selection_hardware()
values += [("kardex", "Kardex")]