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

Bug #1004671 reported by Ferdinand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Undecided
Unassigned

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

Revision history for this message
Ferdinand (office-chricar) wrote :

To reproduce
install new db with warehouse
all moves are created with date=today
* warehouse / inventory control / Location structure
choose physical location / Your company
* To date = yesterday (don't forget to click another field to make the date available )
result -> all products on hand are 0 - correct
now export data
result -> products have a quantity on hand (using all stock_move data available)

THIS IS A MAJOR ISSUE !!!!

users can not know which data are computed function fields and which are stored values.

user must be able to rely on WYSIWYG - it's accounting not gambling

summary: - web client and export to excel show different results
+ web client and export to excel show different results - VERY GRAVE
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.