Files
app-odoo/app_procurement_for_subcontract_service/models/procurement.py
guohuadeng 92bcaf9e0b fix
2018-07-24 04:49:09 +08:00

27 lines
874 B
Python

# # Author: Damien Crier
# # Copyright 2017 Camptocamp SA
# # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
#
from odoo import api, models, _
class ProcurementGroup(models.Model):
_inherit = "procurement.group"
@api.model
def _is_subcontracted_service(self, product_id):
return (product_id.type == 'service' and
product_id.property_subcontracted_service or
False)
@api.model
def _get_rule(self, product_id, location_id, values):
res = super(ProcurementGroup, self)._get_rule(product_id, location_id, values)
if not res:
if self._is_subcontracted_service(product_id):
rule_id = location_id.get_warehouse().\
subcontracting_service_proc_rule_id
if rule_id:
return rule_id
return res