← Back to team overview

openerp-india team mailing list archive

[Bug 1004671] Re: web client and export to excel show different results - VERY GRAVE

 

*** This bug is a duplicate of bug 1002173 ***
    https://bugs.launchpad.net/bugs/1002173

** This bug has been marked a duplicate of bug 1002173
   export (csv, excel) must use the computed fields as displayed

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

Title:
  web client and export to excel show different results - VERY GRAVE

Status in OpenERP Server:
  New

Bug description:
  the following setup:

  
      def _get_expense_account(self, cr, uid, ids, field_name, arg, context=None):
           res = {}
           for product in self.browse(cr, uid, ids, context=context):
                   res[product.id] =  product.property_account_expense.id  or product.categ_id.property_account_expense_categ.id or None
           return res

  ....
          'expense_account_id':  fields.function(_get_expense_account, method=True, string='Expense Account', type='many2one', relation='account.account',  select="1", 
                  store=True ),
   
  after installing weblcient and excel show the same result

  after updateing the expense account in product_category the web client
  uses the updated account from category , export to excel uses the
  stored value

  I admit it's a programming error hence I changed

      def _get_product_expense(self, cr, uid, ids, context=None):
           _logger  = logging.getLogger(__name__)
           _logger.debug('FGF _get_product_expense ids %s' % ids)
           product_ids = []
           product_ids = self.pool.get('product.product').search(cr, uid, [('categ_id','in', ids)])
           _logger.debug('FGF _get_product_expense product_ids %s' % product_ids)
           return product_ids

          'expense_account_id':  fields.function(_get_expense_account, method=True, string='Expense Account', type='many2one', relation='account.account',  select="1",
                     store =  {
                        'product.category' : ( _get_product_expense, ['property_account_expense_categ'], 10)
                              }
                     ),

  again the web client displays the correct account and Excel export
  something else

  to inspect
  select name_template , expense_account_id,p.write_date from product_product p, product_template t where t.id=p.product_tmpl_id and  categ_id=17 order by 3;

  it turnes out that the stored field expense_account_id never changes
  apparently only the property gets updated but not the stored field

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


References