FIX module tests

This commit is contained in:
Raimon Esteve 2018-08-30 15:33:08 +02:00
parent 851e672371
commit 03596a5115
2 changed files with 16 additions and 15 deletions

View File

@ -22,7 +22,7 @@ class Statement:
__metaclass__ = PoolMeta __metaclass__ = PoolMeta
__name__ = 'account.statement' __name__ = 'account.statement'
users = fields.Function(fields.One2Many('res.user', None, 'Users'), users = fields.Function(fields.One2Many('res.user', None, 'Users'),
'get_users', setter='set_users', searcher='search_users') 'get_users', searcher='search_users')
@classmethod @classmethod
def get_users(cls, statements, names): def get_users(cls, statements, names):

View File

@ -52,6 +52,7 @@ Create parties::
>>> Party = Model.get('party.party') >>> Party = Model.get('party.party')
>>> customer = Party(name='Customer') >>> customer = Party(name='Customer')
>>> customer.account_receivable = receivable
>>> customer.save() >>> customer.save()
Create category:: Create category::
@ -103,8 +104,8 @@ Create a shop::
>>> shop = Shop() >>> shop = Shop()
>>> shop.name = 'Local shop' >>> shop.name = 'Local shop'
>>> shop.warehouse = warehouse >>> shop.warehouse = warehouse
>>> shop.shipment_method = 'order' >>> shop.sale_shipment_method = 'order'
>>> shop.invoice_method = 'order' >>> shop.sale_invoice_method = 'order'
>>> sequence, = Sequence.find([('code', '=', 'sale.sale')]) >>> sequence, = Sequence.find([('code', '=', 'sale.sale')])
>>> shop.sale_sequence = sequence >>> shop.sale_sequence = sequence
>>> shop.payment_term = payment_term >>> shop.payment_term = payment_term
@ -203,8 +204,8 @@ Open statements for current device::
0 0
>>> open_statment = Wizard('open.statement') >>> open_statment = Wizard('open.statement')
>>> open_statment.execute('create_') >>> open_statment.execute('create_')
>>> open_statment.form.result >>> open_statment.form.result == 'Statement Default opened. \n'
u'Statement Default opened. \n' True
>>> payment_statement, = Statement.find([('state', '=', 'draft')]) >>> payment_statement, = Statement.find([('state', '=', 'draft')])
Partially pay the sale:: Partially pay the sale::
@ -256,8 +257,8 @@ An invoice should be created for the sale::
>>> invoice, = sale.invoices >>> invoice, = sale.invoices
>>> config.user = account_user.id >>> config.user = account_user.id
>>> invoice.state >>> invoice.state == 'posted'
u'posted' True
>>> invoice.untaxed_amount >>> invoice.untaxed_amount
Decimal('20.00') Decimal('20.00')
>>> invoice.tax_amount >>> invoice.tax_amount
@ -269,19 +270,19 @@ When the statement is closed the invoices are paid and sale is done::
>>> close_statment = Wizard('close.statement') >>> close_statment = Wizard('close.statement')
>>> close_statment.execute('validate') >>> close_statment.execute('validate')
>>> close_statment.form.result >>> close_statment.form.result == 'Statement Default - Default closed. \n'
u'Statement Default - Default closed. \n' True
>>> payment_statement.reload() >>> payment_statement.reload()
>>> payment_statement.state >>> payment_statement.state == 'validated'
u'validated' True
>>> all(l.invoice == invoice for l in payment_statement.lines) >>> all(l.invoice == invoice for l in payment_statement.lines)
True True
>>> payment_statement.balance >>> payment_statement.balance
Decimal('22.00') Decimal('22.00')
>>> invoice.reload() >>> invoice.reload()
>>> invoice.state >>> invoice.state == 'paid'
u'paid' True
>>> config.user = sale_user.id >>> config.user = sale_user.id
>>> sale.reload() >>> sale.reload()
>>> sale.state >>> sale.state == 'done'
u'done' True