Skip to content

Commit

Permalink
update migration script
Browse files Browse the repository at this point in the history
  • Loading branch information
gurneyalex committed May 8, 2017
1 parent 98d977a commit 9d9588d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions odoo/migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,6 @@ migration:
upgrade:
- specific_sale
- specific_inter_company
operations:
post:
- anthem songs.upgrade.10_0_14.intercompany::main
Empty file.
28 changes: 28 additions & 0 deletions odoo/songs/upgrade/10_0_14/intercompany.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

import anthem


@anthem.log
def set_intercompany_rules(ctx):
warehouse = ctx.env['stock.warehouse']
holding = ctx.env.ref('__setup__.roctool_holding')
for company in ctx.env['res.company'].search([('id', '!=', holding.id)]):
warehouse_id = warehouse.search([('company_id', '=', company.id)])[0]
vals = {
'so_from_po': (company.name == 'RocTool SA'),
'po_from_so': False,
'warehouse_id': warehouse_id.id,
'ref': 'r%s' % company.country_id.code.lower(),
'customer': 1,
'supplier': (company.name == 'RocTool SA'),
}
company.write(vals)


@anthem.log
def main(ctx):
""" Main: creating intercompany rules """
set_intercompany_rules(ctx)

0 comments on commit 9d9588d

Please sign in to comment.