~unifield-team/unifield-wm/us-671-homere

« back to all changes in this revision

Viewing changes to product_nomenclature/product_nomenclature.py

  • Committer: Fabien MORIN
  • Date: 2016-01-04 13:16:43 UTC
  • mto: This revision was merged to the branch mainline in revision 2735.
  • Revision ID: fabien.morin@tempo-consulting.fr-20160104131643-yg05m7g044qrom9w
SP-223 [FIX] After discussion with JFB, the way to introduce force_no_order
parameter was bad because it implies too heavy modifications on the whole code.
It is better to use existing 'order' parameter, 'limit' and 'count' as a
combination to get the same result and force removing 'ORDER BY' in the case
that doesnt need it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
818
818
            if not default_code or not vals.get('xmlid_code', False):
819
819
                raise Exception, "Problem creating product: Missing xmlid_code/default_code in the data"
820
820
            exist_dc = self.search(cr, uid, [('default_code', '=',
821
 
                default_code)], force_no_order=True, limit=1, context=context)
 
821
                default_code)], limit=1, context=context, count=True)
822
822
            exist_xc = self.search(cr, uid, [('xmlid_code', 'in', [default_code, xmlid_code])],
823
 
                    force_no_order=True, limit=1, context=context)
 
823
                    limit=1, context=context, count=True)
824
824
            if exist_dc:  # if any of the code exists, report error!,
825
825
                raise Exception, "Problem creating product: Duplicate default_code found"
826
826
            if exist_xc:  # if any of the code exists, report error!,