Files
public/directive_common/models/stock_picking.py

25 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from odoo import models
class StockPicking(models.Model):
_name = 'stock.picking'
_inherit = ["stock.picking", "directive.mixin"]
def button_validate(self):
res = super().button_validate()
# Сохраняем семантику старого monkey-patch wrapper: политика срабатывала
# ТОЛЬКО если метод не вернул False, и НЕ должна срабатывать на промежуточном
# возврате экшена-визарда (backorder / immediate transfer), т.к. в этот момент
# перемещение ещё не проведено.
if res is not False and not (isinstance(res, dict) and res.get("type") == "ir.actions.act_window"):
self._directive_run_callback_policies("button_validate")
return res
def action_agv_callback(self, payload: dict):
for picking in self:
picking.message_post(
body="AGV Unit 01: Доставка в зону производства выполнена.<br/>"
"Батарея: 84%."
)
return True