Merge lp:~openbig/bigconsulting/modify_product_ean13_generator_last into lp:bigconsulting

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
Reviewer Review Type Date Requested Status
openbig Pending
Review via email: mp+28966@code.launchpad.net

Description of the change

modify product_ean13_generator

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

Subscribers

People subscribed via source and target branches