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
1=== modified file 'tr_barcode/__openerp__.py'
2--- tr_barcode/__openerp__.py 2014-04-08 12:03:02 +0000
3+++ tr_barcode/__openerp__.py 2014-06-20 07:40:31 +0000
4@@ -21,7 +21,7 @@
5
6 {
7 'name': 'TR Barcode',
8- 'version': '1.1.1',
9+ 'version': '1.1.4',
10 'category': 'Warehouse Management',
11 'description': """
12
13
14=== added directory 'tr_barcode/migrations'
15=== added directory 'tr_barcode/migrations/1.1.4'
16=== added file 'tr_barcode/migrations/1.1.4/pre-migrate.py'
17--- tr_barcode/migrations/1.1.4/pre-migrate.py 1970-01-01 00:00:00 +0000
18+++ tr_barcode/migrations/1.1.4/pre-migrate.py 2014-06-20 07:40:31 +0000
19@@ -0,0 +1,24 @@
20+# -*- coding: utf-8 -*-
21+#/#############################################################################
22+#
23+# Author: Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
24+# Copyright (C) 2014 Camptocamp.
25+#
26+# This program is free software: you can redistribute it and/or modify
27+# it under the terms of the GNU Affero General Public License as
28+# published by the Free Software Foundation, either version 3 of the
29+# License, or (at your option) any later version.
30+#
31+# This program is distributed in the hope that it will be useful,
32+# but WITHOUT ANY WARRANTY; without even the implied warranty of
33+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34+# GNU Affero General Public License for more details.
35+#
36+# You should have received a copy of the GNU Affero General Public License
37+# along with this program. If not, see <http://www.gnu.org/licenses/>.
38+#
39+#/#############################################################################
40+
41+def migrate(cr, version):
42+ if version:
43+ cr.execute('ALTER TABLE tr_barcode RENAME COLUMN hight TO height')
44
45=== modified file 'tr_barcode/tr_barcode.py'
46--- tr_barcode/tr_barcode.py 2014-04-08 12:03:02 +0000
47+++ tr_barcode/tr_barcode.py 2014-06-20 07:40:31 +0000
48@@ -64,19 +64,22 @@
49 'image': fields.binary('Data'),
50 'width':fields.integer("Width",
51 help="Leave Blank or 0(ZERO) for default size"),
52- 'hight':fields.integer("Hight",
53+ 'height':fields.integer("Height",
54 help="Leave Blank or 0(ZERO) for default size"),
55 'hr_form':fields.boolean("Human Readable",
56 help="To genrate Barcode In Human readable form"),
57 'barcode_type':fields.selection(_get_code, 'Type'),
58 }
59
60- def get_image(self, value, width, hight, hr, code='QR'):
61+ def get_image(self, value, width, height, hr, code='QR'):
62 """ genrating image for barcode """
63 options = {}
64- if width:options['width'] = width
65- if hight:options['hight'] = hight
66- if hr:options['humanReadable'] = hr
67+ if width:
68+ options['width'] = width
69+ if height:
70+ options['height'] = height
71+ if hr:
72+ options['humanReadable'] = hr
73 options['quiet'] = False
74 options['barWidth'] = 2
75 # options['isoScale'] = 1
76@@ -108,7 +111,7 @@
77 for self_obj in self.browse(cr, uid, ids, context=context):
78 image = self.get_image(self_obj.code,
79 code=self_obj.barcode_type or 'qrcode',
80- width=self_obj.width, hight=self_obj.hight,
81+ width=self_obj.width, height=self_obj.height,
82 hr=self_obj.hr_form)
83 self.write(cr, uid, self_obj.id,
84 {'image':image},context=context)
85
86=== modified file 'tr_barcode/tr_barcode_view.xml'
87--- tr_barcode/tr_barcode_view.xml 2013-02-18 09:27:15 +0000
88+++ tr_barcode/tr_barcode_view.xml 2014-06-20 07:40:31 +0000
89@@ -10,7 +10,7 @@
90 <field name="res_id" select="1" readonly="1"/>
91 <field name="barcode_type" required="1"/>
92 <field name="width"/>
93- <field name="hight"/>
94+ <field name="height"/>
95 <field name="hr_form"/>
96 <newline/>
97 <button name="generate_image" string="Generate Barcode Image" type="object" icon="gtk-go-forward" colspan="2"/>
98
99=== modified file 'tr_barcode/wizard/tr_barcode_wizard.py'
100--- tr_barcode/wizard/tr_barcode_wizard.py 2014-02-28 09:20:57 +0000
101+++ tr_barcode/wizard/tr_barcode_wizard.py 2014-06-20 07:40:31 +0000
102@@ -53,7 +53,7 @@
103 'barcode':fields.char('Barcode',size=256),
104 'width':fields.integer("Width",
105 help="Leave Blank or 0(ZERO) for default size"),
106- 'hight':fields.integer("Hight",
107+ 'height':fields.integer("Height",
108 help="Leave Blank or 0(ZERO) for default size"),
109 'hr_form':fields.boolean("Human Readable",
110 help="To genrate Barcode In Human readable form"),
111@@ -98,7 +98,7 @@
112 'code':self_obj.barcode,
113 'barcode_type':self_obj.barcode_type,
114 'width':self_obj.width,
115- 'hight':self_obj.hight,
116+ 'height':self_obj.height,
117 'hr_form':self_obj.hr_form,
118 'res_model':context.get('src_model',False) or \
119 context['active_model'],
120
121=== modified file 'tr_barcode_config/barcode/barcode_osv.py'
122--- tr_barcode_config/barcode/barcode_osv.py 2014-03-13 10:10:32 +0000
123+++ tr_barcode_config/barcode/barcode_osv.py 2014-06-20 07:40:31 +0000
124@@ -38,7 +38,7 @@
125 'code': vals.get(barcode_config.field.name, False),
126 'barcode_type': barcode_config.barcode_type,
127 'width': barcode_config.width,
128- 'hight': barcode_config.height,
129+ 'height': barcode_config.height,
130 'hr_form': barcode_config.hr_form,
131 }
132 if not barcode_vals['code']:
133@@ -81,7 +81,7 @@
134 'res_id': id,
135 'barcode_type': barcode_config.barcode_type,
136 'width': barcode_config.width,
137- 'hight': barcode_config.height,
138+ 'height': barcode_config.height,
139 'hr_form': barcode_config.hr_form,
140 }
141 if not barcode_vals.get('code', False):

Subscribers

People subscribed via source and target branches