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

Proposed by Manu
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) Approve
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

[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

Revision history for this message
Omar (Pexego) (omar7r) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'product_lot_sequence/product.py'
--- product_lot_sequence/product.py 2011-12-26 12:47:25 +0000
+++ product_lot_sequence/product.py 2011-12-29 18:08:24 +0000
@@ -40,15 +40,19 @@
40 }40 }
4141
42 def create(self, cr, uid, vals, context={}):42 def create(self, cr, uid, vals, context={}):
43 """overwrites create method to create new sequence to production lots"""43 """overwrites create method to create new sequence for production lots"""
44 product_id = super(product_product, self).create(cr, uid, vals, context=context)44 product_id = super(product_product, self).create(cr, uid, vals, context=context)
45 product = self.browse(cr, uid, product_id)45 product = self.browse(cr, uid, product_id)
46 #Manages the sequence number46
47 #Manages a custom sequence number only if the product will be manufactured
48 if not(product.supply_method == 'produce' and product.type != 'service'):
49 return product_id
50
47 if not vals.get('sequence_id'):51 if not vals.get('sequence_id'):
48 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)52 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)
49 if sequence_id:53 if sequence_id:
50 self.write(cr, uid, [product_id], {'sequence_id': sequence_id})54 self.write(cr, uid, [product_id], {'sequence_id': sequence_id})
5155
52 return product_id56 return product_id
5357
54product_product()
55\ No newline at end of file58\ No newline at end of file
59product_product()

Subscribers

People subscribed via source and target branches

to all changes: