← Back to team overview

openerp-india team mailing list archive

[Bug 921594] Re: certain hooks not usable

 

BTW, I suggest to deprecate those hooks and apply this merge proposal instead https://code.launchpad.net/~alexis-via/openobject-addons/extensible-stock-action_invoice_create/+merge/87689
Then we can call modular methods that prepare the the record values instead of persisting it to the database and re-browing and re-computing the the stored function fields which is something extremely slow on large records.

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/921594

Title:
  certain hooks not usable

Status in OpenERP Addons (modules):
  New

Bug description:
  in stock/stock.py we have

                  invoice_line_id = invoice_line_obj.create(cr, uid, {
                      'name': name,
                      'origin': origin,
                      'invoice_id': invoice_id,
                      'uos_id': uos_id,
                      'product_id': move_line.product_id.id,
                      'account_id': account_id,
                      'price_unit': price_unit,
                      'discount': discount,
                      'quantity': move_line.product_uos_qty or move_line.product_qty,
                      'invoice_line_tax_id': [(6, 0, tax_ids)],
                      'account_analytic_id': account_analytic_id,
                  }, context=context)
                  self._invoice_line_hook(cr, uid, move_line, invoice_line_id

  the problem is that create fails if a constraint is violated and the
  hook is never executed

  IMHO the correct approach is the one in

  sale/sale.py

   def _prepare_order_line_procurement
  ....

  here it is possilbe to access the values BEFORE these are written.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/921594/+subscriptions


References