Skip to content

Commit

Permalink
Merge 7d23b29 into 04734e1
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomacr committed Sep 18, 2019
2 parents 04734e1 + 7d23b29 commit 11c8d51
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion stock_picking_state/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields
from odoo import models, fields, api


class StockPicking(models.Model):
Expand All @@ -16,3 +16,13 @@ class StockPicking(models.Model):
index=True,
copy=False,
)

@api.constrains('state')
def change_state(self):
for rec in self:
domain = [
('state', '=', rec.state),
('picking_type', '=', rec.picking_type_code)]
state_detail = self.env['stock.picking.state_detail'].search(
domain, limit=1, order="sequence asc")
rec.state_detail_id = state_detail

0 comments on commit 11c8d51

Please sign in to comment.