← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 861244] Re: [6.1] Voucher with no currency_id

 

Hello,

I checked again here is how I created my instance:

checkout of object-addons revno 5235
checkout of object-server revno 3666

replaced whole l10n_ch module by our c2c l10n_ch module in order to have
all demo data and yaml needed.

Then I tested this way :

Creating new database
  Add more features
    Selection of Invoicing + Comptability & Finance
    Install
    Selection of Switzerland chart of account
    Next

And again * Error in yaml test in server logs

TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'

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

Title:
  [6.1] Voucher with no currency_id

Status in OpenERP Addons (modules):
  Incomplete

Bug description:
  Hello,

  Here are my current revision numbers:

  $ bzr revno addons
  5234
  $ bzr revno server
  3666

  In a yaml test that was properly working on previous versions in our
  l10n_ch module, I get this output.

  
  [2011-09-28 06:53:16,003][ch_6_1_20110928_1] ERROR:tests.l10n_ch:unsupported operand type(s) for /: 'float' and 'NoneType'
  Traceback (most recent call last):
    File ".../server/openerp/tools/yaml_import.py", line 736, in process
      self._process_node(node)
    File ".../server/openerp/tools/yaml_import.py", line 751, in _process_node
      self.process_python(node)
    File ".../server/openerp/tools/yaml_import.py", line 422, in process_python
      unsafe_eval(code_obj, {'ref': self.get_id}, code_context)
    File ".../addons/l10n_ch/test/l10n_ch_dta.yml", line 17, in <module>
      address_invoice_id: base.res_partner_address_8
    File ".../addons/account_payment/wizard/account_payment_populate_statement.py", line 114, in populate_statement
      }, context=context)
    File ".../server/openerp/osv/orm.py", line 3977, in create
      self._validate(cr, user, [id_new], context)
    File ".../server/openerp/osv/orm.py", line 1369, in _validate
      if not fun(self, cr, uid, ids):
    File ".../addons/account_voucher/account_voucher.py", line 1059, in _check_amount
      if not self.pool.get('res.currency').is_zero(cr, uid, obj.voucher_id.currency_id, diff):
    File ".../server/openerp/addons/base/res/res_currency.py", line 121, in is_zero
      return abs(self.round(cr, uid, currency, amount)) < currency.rounding
    File ".../server/openerp/addons/base/res/res_currency.py", line 118, in round
      return round(amount / currency.rounding) * currency.rounding
  TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'
  [2011-09-28 06:53:16,004][ch_6_1_20110928_1] ERROR:init.test:Tests failed to execute in module l10n_ch
  Traceback (most recent call last):
    File ".../server/openerp/modules/loading.py", line 100, in load_test
      _load_data(cr, module_name, idref, mode, 'test')
    File ".../server/openerp/modules/loading.py", line 135, in _load_data
      tools.convert_yaml_import(cr, module_name, fp, idref, mode, noupdate)
    File ".../server/openerp/tools/yaml_import.py", line 801, in yaml_import
      yaml_interpreter.process(yaml_string)
    File ".../server/openerp/tools/yaml_import.py", line 736, in process
      self._process_node(node)
    File ".../server/openerp/tools/yaml_import.py", line 751, in _process_node
      self.process_python(node)
    File ".../server/openerp/tools/yaml_import.py", line 422, in process_python
      unsafe_eval(code_obj, {'ref': self.get_id}, code_context)
    File ".../addons/l10n_ch/test/l10n_ch_dta.yml", line 17, in <module>
      address_invoice_id: base.res_partner_address_8
    File ".../addons/account_payment/wizard/account_payment_populate_statement.py", line 114, in populate_statement
      }, context=context)
    File ".../server/openerp/osv/orm.py", line 3977, in create
      self._validate(cr, user, [id_new], context)
    File ".../server/openerp/osv/orm.py", line 1369, in _validate
      if not fun(self, cr, uid, ids):
    File ".../addons/account_voucher/account_voucher.py", line 1059, in _check_amount
      if not self.pool.get('res.currency').is_zero(cr, uid, obj.voucher_id.currency_id, diff):
    File ".../server/openerp/addons/base/res/res_currency.py", line 121, in is_zero
      return abs(self.round(cr, uid, currency, amount)) < currency.rounding
    File ".../server/openerp/addons/base/res/res_currency.py", line 118, in round
      return round(amount / currency.rounding) * currency.rounding
  TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'

  
  Here is the part of my test generating this error:

  -
    I import the payment line
  -
    !python {model: account.payment.populate.statement}: |
      wiz_id = self.create(cr,uid,[])
      wiz = self.browse(cr, uid, wiz_id)
     
      line_obj = self.pool.get('payment.line')
      pay_line_ids = line_obj.search(cr, uid, [('communication','=','111111111111111111111111111111'),('amount','=','7000')])

      data = { 'lines': [(6, 0, [pay_line_ids[0]])],}
      wiz.write(data)

      context['active_id'] = ref('dta_bank_statement')
      context['active_ids'] = [ref('dta_bank_statement')]
   
      self.populate_statement(cr, uid, [wiz_id], context=context)

  
  Somehow, a voucher is generated without a proper currency_id. It's value is False.

  Here is the full yaml test, but this is only designed for l10n_ch module.
  http://bazaar.launchpad.net/~c2c-localization/openerp-swiss-localization/6.x-trunk/view/head:/l10n_ch/test/l10n_ch_dta.yml

  And as this merge is still pending it might not be fully applicable
  with current version of l10n_ch (because some fix need to be done and
  it could crash before this state). However, it is not normal that a
  voucher got no currency_id when using the populate_statement method
  and fails to compute the rounding of an amount.

  My guess is that the issue is on the voucher level when creating it.
  Weither a check is missing to raise an error, or the currency_id is
  not set correctly by default. Shouldn't it takes the company currency
  ?

  Best regards,
  Yannick

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


References