Merge lp:~openbig/bigconsulting/modify_product_ean13_generator_last into lp:bigconsulting
- modify_product_ean13_generator_last
- Merge into addons
Proposed by
Atik Agewan(OpenERP)
Status: | Merged |
---|---|
Merged at revision: | 39 |
Proposed branch: | lp:~openbig/bigconsulting/modify_product_ean13_generator_last |
Merge into: | lp:bigconsulting |
Diff against target: |
256 lines (+134/-57) 3 files modified
product_ean13_generator/__terp__.py (+1/-1) product_ean13_generator/report/product_ean_generator_report.rml (+120/-43) product_ean13_generator/wizard/generator_ean13.py (+13/-13) |
To merge this branch: | bzr merge lp:~openbig/bigconsulting/modify_product_ean13_generator_last |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
openbig | Pending | ||
Review via email: mp+28966@code.launchpad.net |
Commit message
Description of the change
modify product_
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'product_ean13_generator/__terp__.py' | |||
2 | --- product_ean13_generator/__terp__.py 2010-06-24 10:49:42 +0000 | |||
3 | +++ product_ean13_generator/__terp__.py 2010-07-01 09:00:49 +0000 | |||
4 | @@ -29,7 +29,7 @@ | |||
5 | 29 | "description": """ | 29 | "description": """ |
6 | 30 | * Adds a wizard on product form to generate valid EAN13 product codes. | 30 | * Adds a wizard on product form to generate valid EAN13 product codes. |
7 | 31 | * By default EAN13 will be generated with german country code (404) and 13341 as company code. | 31 | * By default EAN13 will be generated with german country code (404) and 13341 as company code. |
9 | 32 | Each company should this values on administration/sequences to addecuate to his country and company code. | 32 | Each company should change these values on administration/sequences to their country's and company's code. |
10 | 33 | """, | 33 | """, |
11 | 34 | "license" : "GPL-3", | 34 | "license" : "GPL-3", |
12 | 35 | "depends" : ["base","product",], | 35 | "depends" : ["base","product",], |
13 | 36 | 36 | ||
14 | === modified file 'product_ean13_generator/report/product_ean_generator_report.rml' | |||
15 | --- product_ean13_generator/report/product_ean_generator_report.rml 2010-06-03 06:48:10 +0000 | |||
16 | +++ product_ean13_generator/report/product_ean_generator_report.rml 2010-07-01 09:00:49 +0000 | |||
17 | @@ -14,33 +14,37 @@ | |||
18 | 14 | <blockAlignment value="LEFT"/> | 14 | <blockAlignment value="LEFT"/> |
19 | 15 | <blockValign value="TOP"/> | 15 | <blockValign value="TOP"/> |
20 | 16 | <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/> | 16 | <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/> |
21 | 17 | <lineStyle kind="LINEAFTER" colorName="#000000" start="0,0" stop="0,-1"/> | ||
22 | 17 | <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/> | 18 | <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/> |
23 | 18 | <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> | 19 | <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> |
24 | 19 | <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/> | ||
25 | 20 | <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/> | ||
26 | 21 | <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> | ||
27 | 22 | <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/> | ||
28 | 23 | <lineStyle kind="LINEAFTER" colorName="#000000" start="2,0" stop="2,-1"/> | ||
29 | 24 | <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/> | ||
30 | 25 | <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> | ||
31 | 26 | <blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/> | ||
32 | 27 | <blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/> | ||
33 | 28 | <blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/> | ||
34 | 29 | </blockTableStyle> | 20 | </blockTableStyle> |
36 | 30 | <blockTableStyle id="Table2"> | 21 | <blockTableStyle id="Table3"> |
37 | 31 | <blockAlignment value="LEFT"/> | 22 | <blockAlignment value="LEFT"/> |
38 | 32 | <blockValign value="TOP"/> | 23 | <blockValign value="TOP"/> |
39 | 33 | <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/> | 24 | <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/> |
46 | 34 | <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> | 25 | <lineStyle kind="LINEAFTER" colorName="#000000" start="0,0" stop="0,-1"/> |
47 | 35 | <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/> | 26 | <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/> |
48 | 36 | <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> | 27 | <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> |
49 | 37 | <lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/> | 28 | <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,1" stop="0,-1"/> |
50 | 38 | <lineStyle kind="LINEAFTER" colorName="#000000" start="2,0" stop="2,-1"/> | 29 | <lineStyle kind="LINEAFTER" colorName="#000000" start="0,1" stop="0,-1"/> |
51 | 39 | <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> | 30 | <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> |
52 | 40 | </blockTableStyle> | 31 | </blockTableStyle> |
53 | 41 | <initialize> | 32 | <initialize> |
54 | 42 | <paraStyle name="all" alignment="justify"/> | 33 | <paraStyle name="all" alignment="justify"/> |
55 | 43 | </initialize> | 34 | </initialize> |
56 | 35 | <paraStyle name="P1" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="CENTER"/> | ||
57 | 36 | <paraStyle name="P2" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> | ||
58 | 37 | <paraStyle name="P3" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> | ||
59 | 38 | <paraStyle name="P4" fontName="Times-Roman" fontSize="10.0" leading="13"/> | ||
60 | 39 | <paraStyle name="P5" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="CENTER"/> | ||
61 | 40 | <paraStyle name="P6" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="CENTER"/> | ||
62 | 41 | <paraStyle name="P7" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/> | ||
63 | 42 | <paraStyle name="P8" fontName="Times-Roman" fontSize="14.0" leading="17"/> | ||
64 | 43 | <paraStyle name="P9" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/> | ||
65 | 44 | <paraStyle name="P10" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/> | ||
66 | 45 | <paraStyle name="P11" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="LEFT"/> | ||
67 | 46 | <paraStyle name="P12" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> | ||
68 | 47 | <paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> | ||
69 | 44 | <paraStyle name="Standard" fontName="Times-Roman"/> | 48 | <paraStyle name="Standard" fontName="Times-Roman"/> |
70 | 45 | <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> | 49 | <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> |
71 | 46 | <paraStyle name="Heading" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="12.0" spaceAfter="6.0"/> | 50 | <paraStyle name="Heading" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="12.0" spaceAfter="6.0"/> |
72 | @@ -79,43 +83,116 @@ | |||
73 | 79 | <images/> | 83 | <images/> |
74 | 80 | </stylesheet> | 84 | </stylesheet> |
75 | 81 | <story> | 85 | <story> |
76 | 86 | <para style="P13"> | ||
77 | 87 | <font color="white"> .........</font> | ||
78 | 88 | <font color="white"> .........</font> | ||
79 | 89 | <font face="Times-Roman" size="15.0"/> | ||
80 | 90 | <font face="Times-Bold" size="15.0">EAN13 REPORT</font> | ||
81 | 91 | </para> | ||
82 | 82 | <para style="terp_default_8"> | 92 | <para style="terp_default_8"> |
89 | 83 | <font color="white"> </font> | 93 | <font face="Times-Bold" size="10.0"/> |
90 | 84 | </para> | 94 | <font face="Times-Roman" size="10.0">[[repeatIn(objects,'o')]]</font> |
91 | 85 | <para style="Standard"> | 95 | </para> |
92 | 86 | <font color="white"> </font> | 96 | <para style="P4"> |
93 | 87 | </para> | 97 | <font color="white"> </font> |
94 | 88 | <blockTable colWidths="78.0,294.0,167.0" style="Table1"> | 98 | </para> |
95 | 99 | <blockTable colWidths="539.0" style="Table1"> | ||
96 | 89 | <tr> | 100 | <tr> |
97 | 90 | <td> | 101 | <td> |
105 | 91 | <para style="terp_default_Bold_12">Code</para> | 102 | <para style="P11">Code : <font face="Helvetica" size="10.0">[[ o.code ]]</font></para> |
106 | 92 | </td> | 103 | <para style="P11">Name : <font face="Times-Roman" size="10.0">[[ o.name ]]</font></para> |
107 | 93 | <td> | 104 | <para style="P11">Ean Number:</para> |
101 | 94 | <para style="terp_default_Bold_12">Name</para> | ||
102 | 95 | </td> | ||
103 | 96 | <td> | ||
104 | 97 | <para style="terp_default_Bold_12">EAN 13 Code</para> | ||
108 | 98 | </td> | 105 | </td> |
109 | 99 | </tr> | 106 | </tr> |
110 | 100 | </blockTable> | 107 | </blockTable> |
111 | 101 | <section> | 108 | <section> |
112 | 109 | <para style="P1">[[repeatIn(o.packaging,'a')]]</para> | ||
113 | 110 | <blockTable colWidths="539.0" style="Table3"> | ||
114 | 111 | <tr> | ||
115 | 112 | <td> | ||
116 | 113 | <para style="P7">[[ a.ean ]]</para> | ||
117 | 114 | </td> | ||
118 | 115 | </tr> | ||
119 | 116 | <tr> | ||
120 | 117 | <td> | ||
121 | 118 | <barCode code="code128" barWidth="1.4" barHeight="25">[[ a.ean or removeParentNode('td')]]</barCode> | ||
122 | 119 | </td> | ||
123 | 120 | </tr> | ||
124 | 121 | </blockTable> | ||
125 | 122 | </section> | ||
126 | 123 | <para style="P2"> | ||
127 | 124 | <font color="white"> </font> | ||
128 | 125 | </para> | ||
129 | 126 | <para style="P2"> | ||
130 | 127 | <font color="white"> </font> | ||
131 | 128 | </para> | ||
132 | 129 | <para style="P2"> | ||
133 | 130 | <font color="white"> </font> | ||
134 | 131 | </para> | ||
135 | 132 | <section> | ||
136 | 133 | <para style="P3"> | ||
137 | 134 | <font color="white"> </font> | ||
138 | 135 | </para> | ||
139 | 136 | </section> | ||
140 | 137 | <para style="P3"> | ||
141 | 138 | <font color="white"> </font> | ||
142 | 139 | </para> | ||
143 | 140 | <para style="P1"> | ||
144 | 141 | <font color="white"> </font> | ||
145 | 142 | </para> | ||
146 | 143 | <para style="P1"> | ||
147 | 144 | <font color="white"> </font> | ||
148 | 145 | </para> | ||
149 | 146 | <para style="P1"> | ||
150 | 147 | <font color="white"> </font> | ||
151 | 148 | </para> | ||
152 | 149 | <para style="P1"> | ||
153 | 150 | <font color="white"> </font> | ||
154 | 151 | </para> | ||
155 | 152 | <para style="P1"> | ||
156 | 153 | <font color="white"> </font> | ||
157 | 154 | </para> | ||
158 | 155 | <para style="P1"> | ||
159 | 156 | <font color="white"> </font> | ||
160 | 157 | </para> | ||
161 | 158 | <para style="P1"> | ||
162 | 159 | <font color="white"> </font> | ||
163 | 160 | </para> | ||
164 | 161 | <para style="P3"> | ||
165 | 162 | <font color="white"> </font> | ||
166 | 163 | </para> | ||
167 | 164 | <para style="P3"> | ||
168 | 165 | <font color="white"> </font> | ||
169 | 166 | </para> | ||
170 | 167 | <para style="P3"> | ||
171 | 168 | <font color="white"> </font> | ||
172 | 169 | </para> | ||
173 | 170 | <para style="P3"> | ||
174 | 171 | <font color="white"> </font> | ||
175 | 172 | </para> | ||
176 | 173 | <para style="P3"> | ||
177 | 174 | <font color="white"> </font> | ||
178 | 175 | </para> | ||
179 | 176 | <para style="P3"> | ||
180 | 177 | <font color="white"> </font> | ||
181 | 178 | </para> | ||
182 | 179 | <para style="Standard"> | ||
183 | 180 | <font color="white"> </font> | ||
184 | 181 | </para> | ||
185 | 182 | <para style="Standard"> | ||
186 | 183 | <font color="white"> </font> | ||
187 | 184 | </para> | ||
188 | 185 | <section> | ||
189 | 102 | <para style="terp_default_1">[[repeatIn(objects,'o')]]</para> | 186 | <para style="terp_default_1">[[repeatIn(objects,'o')]]</para> |
203 | 103 | <blockTable colWidths="78.0,294.0,167.0" style="Table2"> | 187 | <para style="terp_default_1"> |
204 | 104 | <tr> | 188 | <font color="white"> </font> |
205 | 105 | <td> | 189 | </para> |
193 | 106 | <para style="terp_default_left_10">[[ o.code ]]</para> | ||
194 | 107 | </td> | ||
195 | 108 | <td> | ||
196 | 109 | <para style="terp_default_left_10">[[ o.name ]]</para> | ||
197 | 110 | </td> | ||
198 | 111 | <td> | ||
199 | 112 | <para style="terp_default_left_10">[[ o.ean13 ]]</para> | ||
200 | 113 | </td> | ||
201 | 114 | </tr> | ||
202 | 115 | </blockTable> | ||
206 | 116 | </section> | 190 | </section> |
207 | 117 | <para style="Standard"> | 191 | <para style="Standard"> |
208 | 118 | <font color="white"> </font> | 192 | <font color="white"> </font> |
209 | 119 | </para> | 193 | </para> |
210 | 194 | <para style="Standard"> | ||
211 | 195 | <font color="white"> </font> | ||
212 | 196 | </para> | ||
213 | 120 | </story> | 197 | </story> |
214 | 121 | </document> | 198 | </document> |
215 | 122 | 199 | ||
216 | === modified file 'product_ean13_generator/report/product_ean_generator_report.sxw' | |||
217 | 123 | Binary files product_ean13_generator/report/product_ean_generator_report.sxw 2010-06-03 06:48:10 +0000 and product_ean13_generator/report/product_ean_generator_report.sxw 2010-07-01 09:00:49 +0000 differ | 200 | Binary files product_ean13_generator/report/product_ean_generator_report.sxw 2010-06-03 06:48:10 +0000 and product_ean13_generator/report/product_ean_generator_report.sxw 2010-07-01 09:00:49 +0000 differ |
218 | === modified file 'product_ean13_generator/wizard/generator_ean13.py' | |||
219 | --- product_ean13_generator/wizard/generator_ean13.py 2010-06-29 06:24:04 +0000 | |||
220 | +++ product_ean13_generator/wizard/generator_ean13.py 2010-07-01 09:00:49 +0000 | |||
221 | @@ -40,22 +40,22 @@ | |||
222 | 40 | product_obj = pooler.get_pool(cr.dbname).get('product.product') | 40 | product_obj = pooler.get_pool(cr.dbname).get('product.product') |
223 | 41 | sequence_obj = pooler.get_pool(cr.dbname).get('ir.sequence') | 41 | sequence_obj = pooler.get_pool(cr.dbname).get('ir.sequence') |
224 | 42 | packaging_obj = pooler.get_pool(cr.dbname).get('product.packaging') | 42 | packaging_obj = pooler.get_pool(cr.dbname).get('product.packaging') |
225 | 43 | |||
226 | 44 | for product in product_obj.browse(cr, uid, data['ids'], context=context): | 43 | for product in product_obj.browse(cr, uid, data['ids'], context=context): |
227 | 45 | ref = sequence_obj.get(cr, uid, 'generator.ean13') | 44 | ref = sequence_obj.get(cr, uid, 'generator.ean13') |
228 | 46 | for pack in product.packaging: | 45 | for pack in product.packaging: |
241 | 47 | ref = sequence_obj.get(cr, uid, 'generator.ean13') | 46 | ean_val = pack.ean |
242 | 48 | sum=0 | 47 | if ean_val == False: |
243 | 49 | for i in range(12): | 48 | ref = sequence_obj.get(cr, uid, 'generator.ean13') |
244 | 50 | if is_pair(i): | 49 | sum=0 |
245 | 51 | sum += int(ref[i]) | 50 | for i in range(12): |
246 | 52 | else: | 51 | if is_pair(i): |
247 | 53 | sum += 3 * int(ref[i]) | 52 | sum += int(ref[i]) |
248 | 54 | new_ean_cc = int(math.ceil(sum / 10.0) * 10 - sum) | 53 | else: |
249 | 55 | new_ean = ref + str(new_ean_cc) | 54 | sum += 3 * int(ref[i]) |
250 | 56 | vals = {'ean': new_ean} | 55 | new_ean_cc = int(math.ceil(sum / 10.0) * 10 - sum) |
251 | 57 | packaging_obj.write(cr, uid, [pack.id], vals) | 56 | new_ean = ref + str(new_ean_cc) |
252 | 58 | 57 | vals = {'ean': new_ean} | |
253 | 58 | packaging_obj.write(cr, uid, [pack.id], vals) | ||
254 | 59 | return {} | 59 | return {} |
255 | 60 | 60 | ||
256 | 61 | class generate_ean13(wizard.interface): | 61 | class generate_ean13(wizard.interface): |