Skip to content

Commit

Permalink
[FIX] account_invoice_line_default_account: Correction of author name.
Browse files Browse the repository at this point in the history
(../account-financial-tools-6.1 rev 103)
  • Loading branch information
Omar authored and SirTakobi committed Apr 21, 2022
1 parent 437ca6b commit 82d239d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions account_invoice_line_default_account/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
##############################################################################
{
'name': 'Account Invoice Line Default Account',
'version': '6.1.r004',
'version': '6.1.r005',
'depends': [
'base',
'account'
],
'author': 'Therp B.V.',
'author': 'Therp BV',
'category': 'Accounting',
'description': '''When entering purchase invoices directly, the user has
to select an account which will be used as a counterpart in the generated
Expand Down
14 changes: 10 additions & 4 deletions account_invoice_line_default_account/model/account_invoice_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
http://www.therp.nl
'''
from openerp.osv import orm
from openerp.tools.translate import _


class account_invoice_line(orm.Model):
Expand All @@ -22,7 +23,9 @@ def _account_id_default(self, cr, uid, context=None):
partner_model = self.pool.get('res.partner')
partner_obj = partner_model.browse(
cr, uid, partner_id, context=context)
if partner_obj and partner_obj.property_account_expense:
assert partner_obj, (
_('No object created for partner %d') % partner_id)
if partner_obj.property_account_expense:
return partner_obj.property_account_expense.id
return False

Expand All @@ -35,11 +38,14 @@ def onchange_account_id(
fposition_id, account_id):
if (account_id and partner_id and (not product_id)
and inv_type in ['in_invoice', 'in_refund']):
# We have an account_id, and is not from a product, so
# store it in partner automagically:
# We have a manually entered account_id (no product_id, so the
# account_id is not the result of a product selection).
# Store this account_id as future default in res_partner.
partner_model = self.pool.get('res.partner')
partner_obj = partner_model.browse(cr, uid, partner_id)
if partner_obj and partner_obj.auto_update_account_expense:
assert partner_obj, (
_('No object created for partner %d') % partner_id)
if partner_obj.auto_update_account_expense:
old_account_id = (
partner_obj.property_account_expense
and partner_obj.property_account_expense.id)
Expand Down

0 comments on commit 82d239d

Please sign in to comment.