forked from OCA/purchase-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] subcontracted_service: Migration to 11.0
- Loading branch information
1 parent
ed6d792
commit 58ad5ed
Showing
11 changed files
with
68 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import models | ||
from .init_hook import post_init_hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import product | ||
from . import procurement | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# Author: Damien Crier | ||
# Copyright 2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
# # 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 ProcurementOrder(models.Model): | ||
_inherit = "procurement.order" | ||
class ProcurementGroup(models.Model): | ||
_inherit = "procurement.group" | ||
|
||
@api.multi | ||
def _is_subcontracted_service(self): | ||
self.ensure_one() | ||
return (self.product_id.type == 'service' and | ||
self.product_id.property_subcontracted_service or | ||
@api.model | ||
def _is_subcontracted_service(self, product_id): | ||
return (product_id.type == 'service' and | ||
product_id.property_subcontracted_service or | ||
False) | ||
|
||
@api.multi | ||
def _find_suitable_rule(self): | ||
res = super(ProcurementOrder, self)._find_suitable_rule() | ||
if self._is_subcontracted_service(): | ||
return ( | ||
self.warehouse_id.subcontracting_service_proc_rule_id.id | ||
) | ||
return res | ||
|
||
@api.multi | ||
def _assign(self): | ||
res = super(ProcurementOrder, self)._assign() | ||
@api.model | ||
def _get_rule(self, product_id, location_id, values): | ||
res = super()._get_rule(product_id, location_id, values) | ||
if not res: | ||
rule_id = self._find_suitable_rule() | ||
if rule_id: | ||
self.write({'rule_id': rule_id}) | ||
return True | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import test_subcontracted_service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters