Merge lp:~camptocamp/stock-logistic-barcode/7.0-fix_1330459-sge+afe into lp:stock-logistic-barcode

Proposed by Alexandre Fayolle - camptocamp
Status: Merged
Merged at revision: 66
Proposed branch: lp:~camptocamp/stock-logistic-barcode/7.0-fix_1330459-sge+afe
Merge into: lp:stock-logistic-barcode
Diff against target: 141 lines (+39/-12)
6 files modified
tr_barcode/__openerp__.py (+1/-1)
tr_barcode/migrations/1.1.4/pre-migrate.py (+24/-0)
tr_barcode/tr_barcode.py (+9/-6)
tr_barcode/tr_barcode_view.xml (+1/-1)
tr_barcode/wizard/tr_barcode_wizard.py (+2/-2)
tr_barcode_config/barcode/barcode_osv.py (+2/-2)
To merge this branch: bzr merge lp:~camptocamp/stock-logistic-barcode/7.0-fix_1330459-sge+afe
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review no tests Approve
Pedro Manuel Baeza code review Approve
Guewen Baconnier @ Camptocamp code review Approve
Sébastien Gendre - Open-Net Pending
Review via email: mp+223866@code.launchpad.net

Description of the change

Rename hight to height

Integrate and enhance Sébastien Gendre's fix, add a migration script.

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

When you want to rename a field, you can also use the 'oldname' argument, example in crm:

        'opt_out': fields.boolean('Opt-Out', oldname='optout',
            help="If opt-out is checked, this contact has refused to receive emails for mass mailing and marketing campaign. "
                    "Filter 'Available for Mass Mailing' allows users to filter the leads when performing mass mailing."),

The ORM would automatically rename the field.

Your version is also a valid way to rename the field so LGTM.

review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thank you very much for the MP and the migration script.

LGTM.

Regards.

review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Good trick, Guewen. I didn't know about oldname argument!

Regards.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM thanks

review: Approve (code review no tests)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tr_barcode/__openerp__.py'
--- tr_barcode/__openerp__.py 2014-04-08 12:03:02 +0000
+++ tr_barcode/__openerp__.py 2014-06-20 07:40:31 +0000
@@ -21,7 +21,7 @@
2121
22{22{
23 'name': 'TR Barcode',23 'name': 'TR Barcode',
24 'version': '1.1.1',24 'version': '1.1.4',
25 'category': 'Warehouse Management',25 'category': 'Warehouse Management',
26 'description': """26 'description': """
2727
2828
=== added directory 'tr_barcode/migrations'
=== added directory 'tr_barcode/migrations/1.1.4'
=== added file 'tr_barcode/migrations/1.1.4/pre-migrate.py'
--- tr_barcode/migrations/1.1.4/pre-migrate.py 1970-01-01 00:00:00 +0000
+++ tr_barcode/migrations/1.1.4/pre-migrate.py 2014-06-20 07:40:31 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2#/#############################################################################
3#
4# Author: Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
5# Copyright (C) 2014 Camptocamp.
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20#/#############################################################################
21
22def migrate(cr, version):
23 if version:
24 cr.execute('ALTER TABLE tr_barcode RENAME COLUMN hight TO height')
025
=== modified file 'tr_barcode/tr_barcode.py'
--- tr_barcode/tr_barcode.py 2014-04-08 12:03:02 +0000
+++ tr_barcode/tr_barcode.py 2014-06-20 07:40:31 +0000
@@ -64,19 +64,22 @@
64 'image': fields.binary('Data'),64 'image': fields.binary('Data'),
65 'width':fields.integer("Width",65 'width':fields.integer("Width",
66 help="Leave Blank or 0(ZERO) for default size"),66 help="Leave Blank or 0(ZERO) for default size"),
67 'hight':fields.integer("Hight",67 'height':fields.integer("Height",
68 help="Leave Blank or 0(ZERO) for default size"),68 help="Leave Blank or 0(ZERO) for default size"),
69 'hr_form':fields.boolean("Human Readable",69 'hr_form':fields.boolean("Human Readable",
70 help="To genrate Barcode In Human readable form"),70 help="To genrate Barcode In Human readable form"),
71 'barcode_type':fields.selection(_get_code, 'Type'),71 'barcode_type':fields.selection(_get_code, 'Type'),
72 }72 }
7373
74 def get_image(self, value, width, hight, hr, code='QR'):74 def get_image(self, value, width, height, hr, code='QR'):
75 """ genrating image for barcode """75 """ genrating image for barcode """
76 options = {}76 options = {}
77 if width:options['width'] = width77 if width:
78 if hight:options['hight'] = hight78 options['width'] = width
79 if hr:options['humanReadable'] = hr79 if height:
80 options['height'] = height
81 if hr:
82 options['humanReadable'] = hr
80 options['quiet'] = False83 options['quiet'] = False
81 options['barWidth'] = 284 options['barWidth'] = 2
82# options['isoScale'] = 185# options['isoScale'] = 1
@@ -108,7 +111,7 @@
108 for self_obj in self.browse(cr, uid, ids, context=context):111 for self_obj in self.browse(cr, uid, ids, context=context):
109 image = self.get_image(self_obj.code,112 image = self.get_image(self_obj.code,
110 code=self_obj.barcode_type or 'qrcode',113 code=self_obj.barcode_type or 'qrcode',
111 width=self_obj.width, hight=self_obj.hight,114 width=self_obj.width, height=self_obj.height,
112 hr=self_obj.hr_form)115 hr=self_obj.hr_form)
113 self.write(cr, uid, self_obj.id,116 self.write(cr, uid, self_obj.id,
114 {'image':image},context=context)117 {'image':image},context=context)
115118
=== modified file 'tr_barcode/tr_barcode_view.xml'
--- tr_barcode/tr_barcode_view.xml 2013-02-18 09:27:15 +0000
+++ tr_barcode/tr_barcode_view.xml 2014-06-20 07:40:31 +0000
@@ -10,7 +10,7 @@
10 <field name="res_id" select="1" readonly="1"/>10 <field name="res_id" select="1" readonly="1"/>
11 <field name="barcode_type" required="1"/>11 <field name="barcode_type" required="1"/>
12 <field name="width"/>12 <field name="width"/>
13 <field name="hight"/>13 <field name="height"/>
14 <field name="hr_form"/>14 <field name="hr_form"/>
15 <newline/>15 <newline/>
16 <button name="generate_image" string="Generate Barcode Image" type="object" icon="gtk-go-forward" colspan="2"/>16 <button name="generate_image" string="Generate Barcode Image" type="object" icon="gtk-go-forward" colspan="2"/>
1717
=== modified file 'tr_barcode/wizard/tr_barcode_wizard.py'
--- tr_barcode/wizard/tr_barcode_wizard.py 2014-02-28 09:20:57 +0000
+++ tr_barcode/wizard/tr_barcode_wizard.py 2014-06-20 07:40:31 +0000
@@ -53,7 +53,7 @@
53 'barcode':fields.char('Barcode',size=256),53 'barcode':fields.char('Barcode',size=256),
54 'width':fields.integer("Width",54 'width':fields.integer("Width",
55 help="Leave Blank or 0(ZERO) for default size"),55 help="Leave Blank or 0(ZERO) for default size"),
56 'hight':fields.integer("Hight",56 'height':fields.integer("Height",
57 help="Leave Blank or 0(ZERO) for default size"),57 help="Leave Blank or 0(ZERO) for default size"),
58 'hr_form':fields.boolean("Human Readable",58 'hr_form':fields.boolean("Human Readable",
59 help="To genrate Barcode In Human readable form"),59 help="To genrate Barcode In Human readable form"),
@@ -98,7 +98,7 @@
98 'code':self_obj.barcode,98 'code':self_obj.barcode,
99 'barcode_type':self_obj.barcode_type,99 'barcode_type':self_obj.barcode_type,
100 'width':self_obj.width,100 'width':self_obj.width,
101 'hight':self_obj.hight,101 'height':self_obj.height,
102 'hr_form':self_obj.hr_form,102 'hr_form':self_obj.hr_form,
103 'res_model':context.get('src_model',False) or \103 'res_model':context.get('src_model',False) or \
104 context['active_model'],104 context['active_model'],
105105
=== modified file 'tr_barcode_config/barcode/barcode_osv.py'
--- tr_barcode_config/barcode/barcode_osv.py 2014-03-13 10:10:32 +0000
+++ tr_barcode_config/barcode/barcode_osv.py 2014-06-20 07:40:31 +0000
@@ -38,7 +38,7 @@
38 'code': vals.get(barcode_config.field.name, False),38 'code': vals.get(barcode_config.field.name, False),
39 'barcode_type': barcode_config.barcode_type,39 'barcode_type': barcode_config.barcode_type,
40 'width': barcode_config.width,40 'width': barcode_config.width,
41 'hight': barcode_config.height,41 'height': barcode_config.height,
42 'hr_form': barcode_config.hr_form,42 'hr_form': barcode_config.hr_form,
43 }43 }
44 if not barcode_vals['code']:44 if not barcode_vals['code']:
@@ -81,7 +81,7 @@
81 'res_id': id,81 'res_id': id,
82 'barcode_type': barcode_config.barcode_type,82 'barcode_type': barcode_config.barcode_type,
83 'width': barcode_config.width,83 'width': barcode_config.width,
84 'hight': barcode_config.height,84 'height': barcode_config.height,
85 'hr_form': barcode_config.hr_form,85 'hr_form': barcode_config.hr_form,
86 }86 }
87 if not barcode_vals.get('code', False):87 if not barcode_vals.get('code', False):

Subscribers

People subscribed via source and target branches