← Back to team overview

openerp-india team mailing list archive

[Bug 921594] [NEW] certain hooks not usable

 

Public bug reported:

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.

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
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


Follow ups

References