Advertisement
Guest User

Untitled

a guest
Feb 14th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. def getProduct():
  2.     Product = Model.get('product.template')
  3.     product, = Product.find([('name', '=', 'CARBON STEEL BALLS  3/8"  1000 -EN')])
  4.     print "Produit EN: " + product.name
  5.     config._context['language'] = 'fr_FR'
  6.     product, = Product.find([('name', '=', 'CARBON STEEL BALLS  3/8"  1000 -EN')])
  7.     print "Produit FR: " + product.name
  8.     config._context['language'] = 'en_EN'
  9.     product, = Product.find([('name', '=', 'CARBON STEEL BALLS  3/8"  1000 -EN')])
  10.     print "Produit EN: " + product.name
  11.  
  12. def newProduct():
  13.  
  14.     config._context['language'] = 'en'
  15.     ProductUom = Model.get('product.uom')
  16.     Product = Model.get('product.template')
  17.     unit, = ProductUom.find([('name', '=', 'Unit')])
  18.  
  19.     product = Product()
  20.     product.name = 'TEST - NAME ENGLISH'
  21.     product.default_uom = unit
  22.     product.type = 'goods'
  23.     product.list_price = Decimal('0')
  24.     product.purchasable = True
  25.     product.save()
  26.     config._context['language'] = 'fr'
  27.     product.name = 'TEST - NOM FRANCAIS'
  28.     product.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement