← Back to team overview

openerp-india team mailing list archive

[Bug 1019267] Re: account default journal not using defaults

 

Hello Ferdinand ,

I have checked this issue with trunk.After some analysis I find out that problem 
in addons  account_invoice.py , Journal_id is overwrite  in onchange_company_id at line 596-597.
if you used   (line : 597)  res_journal_default = ir_values_obj.get_defaults(cr, uid,'account.invoice') 
and its working fine  beacuse  "  res_journal_default = ir_values_obj.get(cr, uid, 'default', 'type=%s' % (type), ['account.invoice']) " this not return a correct value.
 
So I am assigning this issue to addons team.

Thank you!


** Changed in: openobject-addons
   Importance: Undecided => Low

** Changed in: openobject-addons
       Status: New => Confirmed

** Changed in: openobject-addons
     Assignee: (unassigned) => OpenERP R&D Addons Team 3 (openerp-dev-addons3)

-- 
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):
  Confirmed

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


References