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

Proposed by gpa(OpenERP)
Status: Merged
Merged at revision: 12
Proposed branch: lp:~openbig/bigconsulting/changes_to_generate_ean_for_packaging
Merge into: lp:bigconsulting
Diff against target: 18 lines (+9/-0)
1 file modified
product_ean13_generator/wizard/generator_ean13.py (+9/-0)
To merge this branch: bzr merge lp:~openbig/bigconsulting/changes_to_generate_ean_for_packaging
Reviewer Review Type Date Requested Status
openbig Pending
Review via email: mp+26802@code.launchpad.net

Description of the change

Added functionality to generate EAN code for packaging also.

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
=== modified file 'product_ean13_generator/wizard/generator_ean13.py'
--- product_ean13_generator/wizard/generator_ean13.py 2010-06-03 10:45:13 +0000
+++ product_ean13_generator/wizard/generator_ean13.py 2010-06-04 13:22:20 +0000
@@ -54,6 +54,15 @@
54 vals = {'ean13': new_ean}54 vals = {'ean13': new_ean}
55 product_obj.write(cr, uid, [product.id], vals)55 product_obj.write(cr, uid, [product.id], vals)
56 for pack in product.packaging:56 for pack in product.packaging:
57 ref = sequence_obj.get(cr, uid, 'generator.ean13')
58 sum=0
59 for i in range(12):
60 if is_pair(i):
61 sum += int(ref[i])
62 else:
63 sum += 3 * int(ref[i])
64 new_ean_cc = int(math.ceil(sum / 10.0) * 10 - sum)
65 new_ean = ref + str(new_ean_cc)
57 vals = {'ean': new_ean}66 vals = {'ean': new_ean}
58 packaging_obj.write(cr, uid, [pack.id], vals)67 packaging_obj.write(cr, uid, [pack.id], vals)
5968

Subscribers

People subscribed via source and target branches