SHARE
TWEET

test scenario with demo

a guest Aug 10th, 2013 4 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # -*- coding: utf8 -*-
  3.        
  4. from proteus import config, Model
  5. from decimal import Decimal
  6.  
  7. config.set_xmlrpc('https://admin:admin@demo2.4.tryton.org:8069/demo2.4')
  8. config = config.set_trytond()
  9.  
  10. Sale = Model.get('sale.sale')
  11. SaleLine = Model.get('sale.line')
  12.  
  13.  
  14. sale = Sale()
  15.  
  16. Party = Model.get('party.party')
  17. supplier = Party(name='Supplier')
  18. supplier.save()
  19. customer = Party(name='Customer')
  20. customer.save()
  21. sale.party = customer
  22.  
  23. PaymentTerm = Model.get('account.invoice.payment_term')
  24. PaymentTermLine = Model.get('account.invoice.payment_term.line')
  25. payment_term = PaymentTerm(name='Direct')
  26. payment_term_line = PaymentTermLine(type='remainder', days=0)
  27. payment_term.lines.append(payment_term_line)
  28. payment_term.save()
  29. sale.payment_term = payment_term
  30.  
  31. sale.invoice_method = 'order'
  32. sale_line = SaleLine()
  33. sale.lines.append(sale_line)
  34.  
  35. ProductUom = Model.get('product.uom')
  36. unit, = ProductUom.find([('name', '=', 'Unit')])
  37. Product = Model.get('product.product')
  38. product = Product()
  39. product.name = 'product'
  40. product.default_uom = unit
  41. product.type = 'goods'
  42. product.purchasable = True
  43. product.salable = True
  44. product.list_price = Decimal('10')
  45. product.cost_price = Decimal('5')
  46. product.cost_price_method = 'fixed'
  47. product.save()
  48.  
  49. sale_line.product = product
  50. sale_line.quantity = 2.0
  51. sale.save()
  52. Sale.quote([sale], config.context)
  53. Sale.confirm([sale.id], config.context)
  54. Sale.process([sale.id], config.context)
  55. sale.state
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top