← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 788686] Re: Problem with override function module: sale_layout

 

Hello Nicola Riolini,,

I have fixed the problem in lp:~openerp-dev/openobject-addons/trunk-
bug-788686-psi branch, It will be merged in lp:openobject-addons very
soon.

Revision No: 4733
Revision ID: psi@xxxxxxxxxxxxx-20110530124332-qqt0nuumhh5p3ppl

Thanks
Purnendu singh

** Changed in: openobject-addons
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/788686

Title:
  Problem with override function module: sale_layout

Status in OpenERP Modules (addons):
  Fix Committed

Bug description:
  Hi, ubu 10.4, oerp 6.0.2, new db with sale_layout installed:
  I see that function _amount_line is write in sale/sale.py module and sale_layout override it in sale_layout/sale_layout.py file
  I put a pdb.set_trace() in both the function and I see that when I click compute botton in order form the method that is called is the sale one, no work on sale_layout 

  sale.py function:
  class sale_order_line(osv.osv):
      def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
          tax_obj = self.pool.get('account.tax')
          cur_obj = self.pool.get('res.currency')
          res = {}
          if context is None:
              context = {}
          for line in self.browse(cr, uid, ids, context=context):
              price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
              taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id)
              cur = line.order_id.pricelist_id.currency_id
              res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
          return res
   
  sale_layout function: <<<< here openerp don't pass!!!
  class sale_order_line(osv.osv)
      def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
          res = {}
          for line in self.browse(cr, uid, ids, context=context):
              if line.layout_type == 'article':
                  return super(sale_order_line, self)._amount_line(cr, uid, ids, field_name, arg, context)
          return res


References