Merge lp:~manu-tiedra/openobject-addons/pexego_extra_6.0 into lp:~pexego/openobject-addons/extra-6.0

Proposed by Manu on 2011-12-28
Status: Merged
Merged at revision: 18
Proposed branch: lp:~manu-tiedra/openobject-addons/pexego_extra_6.0
Merge into: lp:~pexego/openobject-addons/extra-6.0
Diff against target: 28 lines (+8/-4)
1 file modified
product_lot_sequence/product.py (+8/-4)
To merge this branch: bzr merge lp:~manu-tiedra/openobject-addons/pexego_extra_6.0
Reviewer Review Type Date Requested Status
Omar (Pexego) 2011-12-28 Approve on 2012-02-22
Review via email: mp+87039@code.launchpad.net

Commit message

[FIX] fixed bug creating the lot sequence. name was False in the method create (in product_lot_sequence/product.py)

Description of the change

There was an error creating a sequence in the create method of product_lot_sequence/product.py

product.name was False. I'm using vals["name"] instead. For the explanation I've copied this from product_variant_multi:

    def create(self, cr, uid, vals, context=None):
        #TAKE CARE for inherits objects openerp will create firstly the product_template and after the product_product
        # and so the duplicated fields (duplicated field = field which are on the template and on the variant) will be on the product_template and not on the product_product
        #Also when a product is created the duplicated field are empty for the product.product, this is why the field name can not be a required field
        #This should be fix in the orm in the futur
        ids = super(product_product, self).create(cr, uid, vals.copy(), context=context) #using vals.copy() if not the vals will be changed by calling the super method
        ####### write the value in the product_product

To post a comment you must log in.
18. By Manu on 2011-12-29

[FIX]/[IMP] fixed bug creating the lot sequence. name was False in the method create (in product_lot_sequence/product.py). Also a new lot sequence number is created only if the product will be manufactured to avoid cluttering of sequences

Omar (Pexego) (omar7r) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product_lot_sequence/product.py'
2--- product_lot_sequence/product.py 2011-12-26 12:47:25 +0000
3+++ product_lot_sequence/product.py 2011-12-29 18:08:24 +0000
4@@ -40,15 +40,19 @@
5 }
6
7 def create(self, cr, uid, vals, context={}):
8- """overwrites create method to create new sequence to production lots"""
9+ """overwrites create method to create new sequence for production lots"""
10 product_id = super(product_product, self).create(cr, uid, vals, context=context)
11 product = self.browse(cr, uid, product_id)
12- #Manages the sequence number
13+
14+ #Manages a custom sequence number only if the product will be manufactured
15+ if not(product.supply_method == 'produce' and product.type != 'service'):
16+ return product_id
17+
18 if not vals.get('sequence_id'):
19- sequence_id = get_default_seq_id(cr, uid, product.default_code, product.name, company_id=product.company_id and product.company_id.id or False)
20+ sequence_id = get_default_seq_id(cr, uid, product.default_code, product.name_template, company_id=product.company_id and product.company_id.id or False)
21 if sequence_id:
22 self.write(cr, uid, [product_id], {'sequence_id': sequence_id})
23
24 return product_id
25
26-product_product()
27\ No newline at end of file
28+product_product()

Subscribers

People subscribed via source and target branches

to all changes: