On Saturday, April 25, 2015 at 11:50:25 PM UTC+5:30, Guillem Barba Domingo 
wrote:
>
>
> The problem is in the on_change_account method, not in your proteus code 
> nor data.
>
> Are you using any custom module?
>
No I am not using any custom Modules. Just the standard ones and I am just 
trying to save an invoice and search it through proteus and hence I am not 
even using the client. 

Are you using the same Tryton serie (3.4, 3.6) for server, modules and 
> proteus?
>
I am using trytond(server) v3.6.0
proteus v3.6.0
and i have updated all the standard modules to v3.6.0 with (hg nupdate -u) 
but unlike trytond and proteus, i could not verify them. 

Proteus simulates what is done in tryton client, so on_change and 
> on_chamge_with methods are called. Maybe it's useful to reproduce what you 
> are trying to domanually in the client.
>
Since I am not working on client currently, I shall skip that part. 

> I think it's unnecessary and provably incorrect. The lines.new() method 
> already "append" the line.
>
Thanks and i have  just tried it and it works.

> With this code, the better option is save the invoice after add the lines, 
> which will also create the lines.
>
 yes i just did that and the lines appear to be properly added though.

I think you are missing the "invoice type" field, which determines the 
> account type qllowed (revenue or expenses).
>
invoice.type in my case provides an output  'out_invoice'

*very well*
I tried the corrections provided buy you.

1) added the line details without appending the line to the invoice
2) dint save the line
3) added an account of kind revenue to invoice.account
4) tried saving the invoice.

*error occurred*
UserError: ('UserError', (u'The value of the field "Account" on "Invoice" 
is not valid according to its domain.', ''))

while checking the account in invoice with invoice._get_eval(), it shows:

{'account': 87,
 'accounting_date': None,
 'amount_to_pay': None,
 'amount_to_pay_today': None,
 'cancel_move': None,
 'comment': None,
 'company': 34,
 'create_date': datetime.datetime(2015, 4, 25, 19, 5, 44, 385740),
 'create_uid': 1,
 'currency': 142,
 'currency_date': None,
 'currency_digits': 2,
 'description': None,
 'id': -12,
 'invoice_address': 1,
 'invoice_date': None,
 'invoice_report_cache': None,
 'invoice_report_format': None,
 'journal': 1,
 'lines': [-13, -17],
 'lines_to_pay': [],
 'move': None,
 'number': None,
 'origins': None,
 'party': 1,
 'party_lang': u'en_US',
 'payment_lines': [],
 'payment_term': 26,
 'rec_name': None,
 'reconciled': False,
 'reference': None,
 'state': 'draft',
 'tax_amount': Decimal('36.80'),
 'taxes': [-14],
 'total_amount': Decimal('356.80'),
 'type': 'out_invoice',
 'type_name': None,
 'untaxed_amount': Decimal('320.00'),
 'write_date': None,
 'write_uid': None}

i checked the invoice with invoice._get_eval(), it shows:

{'account': 87,
 'accounting_date': None,
 'amount_to_pay': None,
 'amount_to_pay_today': None,
 'cancel_move': None,
 'comment': None,
 'company': 34,
 'create_date': datetime.datetime(2015, 4, 25, 19, 5, 44, 385740),
 'create_uid': 1,
 'currency': 142,
 'currency_date': None,
 'currency_digits': 2,
 'description': None,
 'id': -12,
 'invoice_address': 1,
 'invoice_date': None,
 'invoice_report_cache': None,
 'invoice_report_format': None,
 'journal': 1,
 'lines': [-13, -17],
 'lines_to_pay': [],
 'move': None,
 'number': None,
 'origins': None,
 'party': 1,
 'party_lang': u'en_US',
 'payment_lines': [],
 'payment_term': 26,
 'rec_name': None,
 'reconciled': False,
 'reference': None,
 'state': 'draft',
 'tax_amount': Decimal('36.80'),
 'taxes': [-14],
 'total_amount': Decimal('356.80'),
 'type': 'out_invoice',
 'type_name': None,
 'untaxed_amount': Decimal('320.00'),
 'write_date': None,
 'write_uid': None}


can you please figure out where i went wrong?
and do let me know if you need the source code...its just a 60 lines or 
so(testing something)

Regards,
Jitesh

Reply via email to