Advertisement
Guest User

Proteus / property fields

a guest
Jul 20th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. from datetime import datetime
  4. from optparse import OptionParser
  5.  
  6. from proteus import Model, Wizard
  7. from proteus import config
  8.  
  9. database = 'example'
  10. user = 'admin'
  11. psw = 'admin'
  12.  
  13. config.set_trytond(database, user=user, password=psw)
  14.  
  15. # ----------------------------
  16.  
  17. Category = Model.get('product.category')
  18. Template = Model.get('product.template')
  19. Product = Model.get('product.product')
  20. UOM = Model.get('product.uom')
  21.  
  22. # Create a category
  23. category1 = Category()
  24. category1.name = 'Category 1'
  25. category1.save()
  26.  
  27. # Create a template
  28. template = Template()
  29. template.name = 'Product template 1'
  30. template.type = 'goods'
  31. template.category = category1
  32.  
  33. product = template.products[0]
  34. product.code = '00001'
  35.  
  36. template.default_uom, = UOM.find([('symbol','=','u')])
  37.  
  38. # How do I assign a list_price or cost_price (Property fields)?
  39. template.list_price = ???????????
  40. template.cost_price = ???????????
  41.  
  42. template.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement