title: Odoo set Sequence in Product Code and Product Barcode
body: <p>I have created new fields <code>Product Code</code> and <code>Product Barcode</code> for using when <code>Product Variant</code> is created.I have created this fields in both <code>product.template</code> and <code>product.product</code> and then when a product is created in <code>Product Template</code> with <code>Product Code</code> and <code>Product Barcode</code>, I want to create a Sequenced <code>Product Code</code> and <code>Product Barcode</code> for <code>Product Variants</code> which will come under <code>product.product</code>.
  Eg:If we give <code>abc</code> as <code>Product Code</code> in <code>Product Template</code> and it have 3 variants, <code>Product Code</code> in <code>Product Template</code> should come as <code>abc-1</code>,abc-2<code>,abc-3</code> respectively.
  Data passing and all is done but in my logic if we delete a variant and add another variant there is a chance it will come in same name.
  Eg: If we delete variant <code>abc-1</code> and add another variant , its <code>Product Code</code> will come as <code>abc-3</code> (which is already available)</p>
  
  <blockquote>
    <p>Code</p>
  </blockquote>
  
  <pre><code>for variant_ids in to_create_variants:
      if self.product_variant_count == 0 :
          count = count + 1
      else :
          count = self.product_variant_count + 1
          new_variant = Product.create({
                          'product_tmpl_id': tmpl_id.id,
                          'attribute_value_ids': [(6, 0, variant_ids.ids)],
                          'xn_product_code' :  str(tmpl_id.xn_product_code_tmpl) +  "-" + str(count),
                          'xn_product_barcode' : str(tmpl_id.xn_product_barcode_tmpl) + "-" + str(count) 
                      })
  </code></pre>