Skip to content

Instantly share code, notes, and snippets.

@ianjosephwilson
Created February 8, 2013 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianjosephwilson/4740868 to your computer and use it in GitHub Desktop.
Save ianjosephwilson/4740868 to your computer and use it in GitHub Desktop.
doctest error
File "tests/scenario_sale_wizard.rst", line 194, in scenario_sale_wizard.rst
Failed example:
sale_line.product = product
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.7/doctest.py", line 1289, in __run
compileflags, 1) in test.globs
File "<doctest scenario_sale_wizard.rst[125]>", line 1, in <module>
sale_line.product = product
File "/home/ian/workspace/tryton-project/stockmodules-tryton-2.6/tryton-instance/ve/lib/python2.7/site-packages/proteus/__init__.py", line 206, in __set__
super(Many2OneDescriptor, self).__set__(instance, value)
File "/home/ian/workspace/tryton-project/stockmodules-tryton-2.6/tryton-instance/ve/lib/python2.7/site-packages/proteus/__init__.py", line 82, in __set__
instance._on_change(self.name)
File "/home/ian/workspace/tryton-project/stockmodules-tryton-2.6/tryton-instance/ve/lib/python2.7/site-packages/proteus/__init__.py", line 816, in _on_change
res = getattr(self._proxy, 'on_change_%s' % name)(args, context)
File "/home/ian/workspace/tryton-project/stockmodules-tryton-2.6/tryton-instance/ve/lib/python2.7/site-packages/proteus/config.py", line 149, in __call__
result = rpc.result(meth(inst, *args, **kwargs))
File "/home/ian/workspace/tryton-project/stockmodules-tryton-2.6/tryton-instance/trytond/trytond/modules/sale/sale.py", line 1092, in on_change_product
if party.lang:
File "/home/ian/workspace/tryton-project/stockmodules-tryton-2.6/tryton-instance/trytond/trytond/model/fields/field.py", line 183, in __get__
return inst.__getattr__(self.name)
File "/home/ian/workspace/tryton-project/stockmodules-tryton-2.6/tryton-instance/trytond/trytond/model/modelstorage.py", line 1280, in __getattr__
for data in self.read(ids, ffields.keys()):
File "/home/ian/workspace/tryton-project/stockmodules-tryton-2.6/tryton-instance/trytond/trytond/model/modelsql.py", line 528, in read
cls.raise_user_error('read_error', cls.__name__)
File "/home/ian/workspace/tryton-project/stockmodules-tryton-2.6/tryton-instance/trytond/trytond/error.py", line 70, in raise_user_error
raise UserError(error)
UserError: ('UserError', (u"You try to read records that don't exist anymore!\n(Document type: party.party)", ''))

Sell 5 products:

>>> Sale = Model.get('sale.sale')
>>> SaleLine = Model.get('sale.line')
>>> sale = Sale()
>>> sale.party = customer
>>> sale.payment_term = payment_term
>>> sale.invoice_method = 'order'
>>> sale.save()
>>> sale_line = SaleLine()
>>> sale_line.sale = sale
>>> sale_line.product = product
>>> sale_line.quantity = 2.0
>>> sale_line.save()
>>> sale.reload()
>>> Sale.quote([sale.id], config.context)
>>> Sale.confirm([sale.id], config.context)
>>> Sale.process([sale.id], config.context)
>>> sale.reload()
>>> sale.state
u'processing'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment