Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
There's something I can't figure out, any help is appreciated. I think I don't understand the new concept 'environment' (env) in the V8 api very well.
Check_total allows to check for mismatches between computed total and invoice total in a purchase account.
Situation : While entering the purchase invoice, I would like to have the remaining amount automaticaly filled when inserting a new invoice_line, sort of inverse running total.
Browsing the code, I stumble upon :
account_invoice.py - class account_invoice_line:
if not self._context.get('check_total'):
total = self._context['check_total']
for l in self._context.get('invoice_line', ):
However, the context variables 'check_total' and 'invoice_line' don't seem to exist. Therefore, _default_price_unit is always returns 0 (zero) instead of check_total minus running total.
Other behaviour I noticed:
- I changed the account_invoice view as so the check_total value is passed to the invoice_line one2many control. The on_change methods on 'product' and 'uom' immediately overwrite the price_unit with 0, as for a new line the product isn't defined yet.
- The VAT isn't calculated in the totals immediately, only when 'apply' is clicked. The code however hints towards other behaviour, see account_invoice.py class account_invoice, function _compute_amount
I have a fix for 1 and 2 (both wip), but I'm unable to retrieve or set the context 'invoice_line' (with_context, ...). I'm also unable to retrieve the current invoice lines when creating a new one (recordset is empty due to @api.model decorator, but removing this doesn't help : there's no link (yet?) with the (although existing, with dbase id) invoice).
What am I missing here?
Ruben De Baets
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 1/26/15, 6:01 AM|
|Seen: 829 times|
|Last updated: 3/16/15, 8:10 AM|