← Back to team overview

openerp-india team mailing list archive

[Bug 1019267] [NEW] account default journal not using defaults

 

Public bug reported:

account/account_invoice.py

this code selects an arbitrary (first) journal which matches the
condition

    def _get_journal(self, cr, uid, context=None):
        if context is None:
            context = {}
        type_inv = context.get('type', 'out_invoice')
        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
        company_id = context.get('company_id', user.company_id.id)
        type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'}
        journal_obj = self.pool.get('account.journal')
        res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'sale')),
                                            ('company_id', '=', company_id)],
                                                limit=1)

the defaults are defined as

select id,name,key2,value from ir_values where model like '%invoi%' and name ='journal_id' ;
  id  |    name    |     key2      | value 
------+------------+---------------+-------
 2283 | journal_id |               | I2   +
      |            |               | .
 2284 | journal_id | partner_id=84 | I13  +
      |            |               | .
 2285 | journal_id | partner_id=85 | I13  +
      |            |               | .
 2286 | journal_id | partner_id=83 | I13  +
      |            |               | .
(4 rows)

the  _get_journal function
must respect the existing defaults

patch follows soon

** 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/1019267

Title:
  account default journal not using defaults

Status in OpenERP Addons (modules):
  New

Bug description:
  account/account_invoice.py

  this code selects an arbitrary (first) journal which matches the
  condition

      def _get_journal(self, cr, uid, context=None):
          if context is None:
              context = {}
          type_inv = context.get('type', 'out_invoice')
          user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
          company_id = context.get('company_id', user.company_id.id)
          type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'}
          journal_obj = self.pool.get('account.journal')
          res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'sale')),
                                              ('company_id', '=', company_id)],
                                                  limit=1)
  
  the defaults are defined as

  select id,name,key2,value from ir_values where model like '%invoi%' and name ='journal_id' ;
    id  |    name    |     key2      | value 
  ------+------------+---------------+-------
   2283 | journal_id |               | I2   +
        |            |               | .
   2284 | journal_id | partner_id=84 | I13  +
        |            |               | .
   2285 | journal_id | partner_id=85 | I13  +
        |            |               | .
   2286 | journal_id | partner_id=83 | I13  +
        |            |               | .
  (4 rows)

  the  _get_journal function
  must respect the existing defaults

  patch follows soon

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


Follow ups

References