forked from OCA/hr
-
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.
- Loading branch information
1 parent
98d977a
commit 9d9588d
Showing
3 changed files
with
31 additions
and
0 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
Empty file.
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,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) |