Skip to content

Commit

Permalink
[MIG] stock_vertical_lift{,_kardex}: Migration to 13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
guewen committed Jan 13, 2020
1 parent 9967056 commit e1c9062
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 28 deletions.
2 changes: 1 addition & 1 deletion stock_vertical_lift/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions stock_vertical_lift/demo/product_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>
5 changes: 4 additions & 1 deletion stock_vertical_lift/demo/stock_inventory_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
1 change: 0 additions & 1 deletion stock_vertical_lift/demo/stock_location_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
13 changes: 7 additions & 6 deletions stock_vertical_lift/models/stock_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ def _compute_vertical_lift_kind(self):
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"
Expand All @@ -66,8 +65,7 @@ def _compute_vertical_lift_shuttle_id(self):

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
Expand Down Expand Up @@ -104,6 +102,9 @@ def _hardware_vertical_lift_tray_payload(self, cell_location=None):
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)
Expand All @@ -112,7 +113,7 @@ def _hardware_vertical_lift_tray_payload(self, cell_location=None):
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()

Expand Down
3 changes: 1 addition & 2 deletions stock_vertical_lift/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
9 changes: 4 additions & 5 deletions stock_vertical_lift/models/vertical_lift_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -34,11 +34,10 @@ def record_answer(self, answer):
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:
Expand Down
6 changes: 2 additions & 4 deletions stock_vertical_lift/models/vertical_lift_shuttle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import socket
import ssl

from odoo import _, api, fields, models
from odoo import _, fields, models

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -49,7 +49,6 @@ class VerticalLiftShuttle(models.Model):
)
]

@api.model
def _selection_hardware(self):
return [("simulation", "Simulation")]

Expand Down Expand Up @@ -161,7 +160,7 @@ def action_open_screen(self):
"res_id": operation.id,
"target": "fullscreen",
"flags": {
"headless": True,
"withControlPanel": False,
"form_view_initial_mode": "edit",
"no_breadcrumbs": True,
},
Expand Down Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion stock_vertical_lift/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def _create_inventory(cls, products):
"""
values = {
"name": "Test Inventory",
"filter": "partial",
"line_ids": [
(
0,
Expand Down
2 changes: 1 addition & 1 deletion stock_vertical_lift/views/stock_move_line_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
1 change: 0 additions & 1 deletion stock_vertical_lift/views/vertical_lift_shuttle_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion stock_vertical_lift_kardex/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions stock_vertical_lift_kardex/models/vertical_lift_shuttle.py
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -24,7 +24,6 @@
class VerticalLiftShuttle(models.Model):
_inherit = "vertical.lift.shuttle"

@api.model
def _selection_hardware(self):
values = super()._selection_hardware()
values += [("kardex", "Kardex")]
Expand Down

0 comments on commit e1c9062

Please sign in to comment.