-
-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by jbeficent
- Loading branch information
Showing
11 changed files
with
136 additions
and
38 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
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
43 changes: 43 additions & 0 deletions
43
purchase_request_procurement/migrations/10.0.1.1.0/post-migration.py
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2018 Eficent Business and IT Consulting Services S.L. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0). | ||
|
||
import logging | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def fill_purchase_request_group_id(cr): | ||
logger.info('Migrating procurement group in purchase request.') | ||
|
||
cr.execute(""" | ||
UPDATE purchase_request as pr | ||
SET group_id = rule.group_id | ||
FROM purchase_request_line as prl | ||
INNER JOIN procurement_order as proc | ||
ON proc.id = prl.procurement_id | ||
INNER JOIN procurement_group as pg | ||
ON proc.group_id = pg.id | ||
INNER JOIN procurement_rule as rule | ||
ON rule.id = proc.rule_id | ||
WHERE prl.request_id = pr.id | ||
AND rule.group_propagation_option = 'fixed' | ||
""") | ||
|
||
cr.execute(""" | ||
UPDATE purchase_request as pr | ||
SET group_id = pg.id | ||
FROM purchase_request_line as prl | ||
INNER JOIN procurement_order as proc | ||
ON proc.id = prl.procurement_id | ||
INNER JOIN procurement_group as pg | ||
ON proc.group_id = pg.id | ||
INNER JOIN procurement_rule as rule | ||
ON rule.id = proc.rule_id | ||
WHERE prl.request_id = pr.id | ||
AND rule.group_propagation_option = 'propagate' | ||
""") | ||
|
||
|
||
def migrate(cr, version): | ||
if not version: | ||
return | ||
fill_purchase_request_group_id(cr) |
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
19 changes: 19 additions & 0 deletions
19
purchase_request_procurement/views/purchase_request_view.xml
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0"?> | ||
<!-- Copyright 2016 Eficent Business and IT Consulting Services S.L. | ||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) --> | ||
<odoo> | ||
|
||
<record model="ir.ui.view" id="view_purchase_request_form"> | ||
<field name="name">purchase.request.form</field> | ||
<field name="model">purchase.request</field> | ||
<field name="inherit_id" | ||
ref="purchase_request.view_purchase_request_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="assigned_to" position="after"> | ||
<field name="group_id" | ||
attrs="{'readonly': [('is_editable','=', False)]}"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
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