Public release from ruodoo-project: 19.0 - 2026-07-26 21:17:35 UTC
This commit is contained in:
31
directive_test/models/sale_order.py
Normal file
31
directive_test/models/sale_order.py
Normal file
@ -0,0 +1,31 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_name = 'sale.order'
|
||||
_inherit = ["sale.order", "directive.mixin"]
|
||||
|
||||
def _directive_generation_spec(self):
|
||||
return [
|
||||
{
|
||||
"event": "on_write",
|
||||
"key": "so_trigger_wms",
|
||||
"field": "state",
|
||||
"from": "draft",
|
||||
"to": "sale",
|
||||
"use_record_template_group": True,
|
||||
"mode": "create_once",
|
||||
}
|
||||
]
|
||||
|
||||
def action_wms_response(self, payload: dict):
|
||||
for order in self:
|
||||
bin_location = "ZONE-A-ROW-5"
|
||||
|
||||
order.message_post(
|
||||
body=f"WMS Агент: Товар зарезервирован."
|
||||
f"Ячейка: {bin_location}<br/>"
|
||||
f"Директива #{payload.get('directive_id')} закрыта успешно."
|
||||
)
|
||||
|
||||
return True
|
||||
Reference in New Issue
Block a user