mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[9.0] rma_purchase: add purchase_policy
cherry-pick 2100329188e45bf465d43b47c7e45cdb5041bc11
This commit is contained in:
committed by
Jordi Ballester Alomar
parent
0d1eba7631
commit
80104557a1
25
rma_purchase/models/rma_operation.py
Normal file
25
rma_purchase/models/rma_operation.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
from openerp import api, fields, models, _
|
||||
from openerp.exceptions import ValidationError
|
||||
|
||||
|
||||
class RmaOperation(models.Model):
|
||||
_inherit = 'rma.operation'
|
||||
|
||||
purchase_policy = fields.Selection(
|
||||
selection=[('no', 'Not required'),
|
||||
('ordered', 'Based on Ordered Quantities'),
|
||||
('delivered', 'Based on Delivered Quantities')],
|
||||
string="Purchase Policy", default='no',
|
||||
)
|
||||
|
||||
@api.multi
|
||||
@api.constrains('purchase_policy')
|
||||
def _check_purchase_policy(self):
|
||||
if self.filtered(
|
||||
lambda r: r.purchase_policy != 'no' and r.type != 'supplier'):
|
||||
raise ValidationError(_(
|
||||
'Purchase Policy can only apply to supplier operations'))
|
||||
Reference in New Issue
Block a user