~opencrea/+junk/aprobio

« back to all changes in this revision

Viewing changes to base_report_to_printer/migrations/9.0.2.0.0/post-10-create_server_record.py

  • Committer: joannes
  • Date: 2017-05-17 09:40:42 UTC
  • Revision ID: joannes@debian-20170517094042-47q3j6on72w2h1il
community module

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
# Copyright (C) 2016 SYLEAM (<http://www.syleam.fr>)
 
3
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 
4
 
 
5
from openerp import SUPERUSER_ID, api
 
6
from openerp.tools.config import config
 
7
 
 
8
__name__ = 'Create a printing.server record from previous configuration'
 
9
 
 
10
 
 
11
def migrate(cr, v):
 
12
    with api.Environment.manage():
 
13
        uid = SUPERUSER_ID
 
14
        env = api.Environment(cr, uid, {})
 
15
        env['printing.server'].create({
 
16
            'name': config.get('cups_host', 'localhost'),
 
17
            'address': config.get('cups_host', 'localhost'),
 
18
            'port': config.get('cups_port', 631),
 
19
        })