~zaber/openobject-client/main

« back to all changes in this revision

Viewing changes to scripts/connector_products.py

  • Committer: donkirkby+launpd at gmail
  • Date: 2012-06-14 23:02:13 UTC
  • Revision ID: donkirkby+launpd@gmail.com-20120614230213-f71rjxitatwcao2m
[IMP] Add script to clean up zombie procurements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
                                  ['id'])
66
66
    product_ids = [product_row['id'] for product_row in product_rows]
67
67
    exclusion_ids[category_id] = product_ids
68
 
    addition_product_code = get_addition(name)
 
68
    added_product_code = get_addition(name)
69
69
    product_rows = c.search_fetch('product.product',
70
 
                                  [('default_code', '=', addition_product_code)],
 
70
                                  [('default_code', '=', added_product_code)],
71
71
                                  ['id'])
 
72
    assert len(product_rows) == 1, "Product '%s' must exist." % added_product_code
72
73
    addition_ids[category_id] = product_rows[0]['id']
73
74
    
74
75
template_rows = c.search_fetch(
102
103
        continue
103
104
    if re.match('.*-M\d+(T2)?$', product.default_code):
104
105
        continue
 
106
    if re.match('.*-T\d+$', product.default_code):
 
107
        continue
105
108
    
106
109
    product.product_tmpl_id = template_id
107
110
    product.default_code += '-T4'
109
112
        product.weight += 0.01
110
113
        product.weight_net += 0.01
111
114
    products[product.id] = product
 
115
 
 
116
print '\n'.join(sorted([product.default_code for product in products.values()]))
112
117
    
113
118
# find the parent BOM's for the products we are cloning.
114
119
boms = {}