I have written the following program based on scenario_reports.rst (in 
account module's test) but keep getting error when I call create_company. 
What is my mistake and how to solve it?

"Program : 

#========================
#Account Reports Scenario
#========================

#Imports::

import datetime
from dateutil.relativedelta import relativedelta
from decimal import Decimal
from proteus import config, Model, Wizard, Report
from trytond.modules.company.tests.tools import create_company, get_company
from trytond.modules.account.tests.tools import create_fiscalyear, 
create_chart, get_accounts
today = datetime.date.today()

#Create database::

config = config.set_trytond()
config.pool.test = True

#Install account::

Module = Model.get('ir.module')
module, = Module.find([ ('name', '=', 'account'), ])
module.click('install')
Wizard('ir.module.install_upgrade').execute('upgrade')
#Create company::

_ = create_company()
#company = get_company()





#Error that I get :

python mytest1.py
/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/trytond/ir/action.py:393:
 
DeprecationWarning: on_change_with argument is deprecated, use the depends 
decorator
  on_change_with=['name', 'template_extension']),

Traceback (most recent call last):
  File "mytest1.py", line 29, in <module>
    _ = create_company()
  File 
"/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/trytond/modules/company/tests/tools.py",
 
line 21, in create_company
    party.save()
  File 
"/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/proteus/__init__.py",
 
line 101, in newfunc
    return self.func(owner, [instance], *args, **kwargs)
  File 
"/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/proteus/__init__.py",
 
line 758, in save
    ids = proxy.create(values, context)
  File 
"/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/proteus/config.py", 
line 174, in __call__
    result = rpc.result(meth(*args, **kwargs))
  File 
"/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/trytond/modules/party/party.py",
 
line 164, in create
    return super(Party, cls).create(vlist)
  File 
"/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/trytond/model/modelsql.py",
 
line 601, in create
    cls._validate(sub_records)
  File 
"/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/trytond/model/modelstorage.py",
 
line 1004, in _validate
    field_name)
  File 
"/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/trytond/model/modelstorage.py",
 
line 988, in required_test
    error_args=cls._get_error_args(field_name))
  File 
"/home/ubuntu/Envs/tryton/local/lib/python2.7/site-packages/trytond/error.py", 
line 74, in raise_user_error
    raise UserError(error)
trytond.exceptions.UserError: ('UserError', (u'The field "Account Payable" 
on "Party" is required.', ''))


-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/4c6c0c95-23bd-4d00-a0c6-e8114a541fc8%40googlegroups.com.

Reply via email to