Skip to content

Commit

Permalink
[MIG] account_invoice_line_default_account: Migration to 10.0
Browse files Browse the repository at this point in the history
account_invoice_line_default_account: search based on xmlid as name is translatable
[FIX] pylint
  • Loading branch information
jbaudoux authored and SirTakobi committed Apr 22, 2022
1 parent 45e5305 commit 42608c4
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 63 deletions.
19 changes: 2 additions & 17 deletions account_invoice_line_default_account/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,17 @@ partner record.
Usage
=====

To use this module, you need to:

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/95/8.0

.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example
For further information, please visit:
:target: https://runbot.odoo-community.org/runbot/95/10.0

* https://www.odoo.com/forum/help-1

Known issues / Roadmap
======================

* ...

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/{project_repo}/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/{project_repo}/issues/new?body=module:%20{module_name}%0Aversion:%20{version}%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.

Credits
=======
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_line_default_account/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: UTF-8 -*-
# -*- coding: utf-8 -*-

from . import models
1 change: 1 addition & 0 deletions account_invoice_line_default_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'account'
],
'author': 'Therp BV,BCIM,Odoo Community Association (OCA)',
'license': 'AGPL-3',
'contributors': ['Jacques-Etienne Baudoux <[email protected]>'],
'category': 'Accounting',
'data': [
Expand Down
39 changes: 0 additions & 39 deletions account_invoice_line_default_account/__openerp__.py

This file was deleted.

2 changes: 1 addition & 1 deletion account_invoice_line_default_account/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: UTF-8 -*-
# -*- coding: utf-8 -*-

from . import res_partner
from . import account_invoice_line
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: UTF-8 -*-
# -*- coding: utf-8 -*-
# Copyright 2012 Therp BV (<http://therp.nl>)
# Copyright 2013-2018 BCIM SPRL (<http://www.bcim.be>)

Expand Down
28 changes: 24 additions & 4 deletions account_invoice_line_default_account/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
# -*- coding: UTF-8 -*-
# -*- coding: utf-8 -*-
# Copyright 2012 Therp BV (<http://therp.nl>)
# Copyright 2013-2018 BCIM SPRL (<http://www.bcim.be>)

from odoo import models, fields
from odoo import models, fields, api


class AccountAccountType(models.Model):
_inherit = 'account.account.type'

@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
# Support xmlid in domain
res = []
if operator == '=':
try:
o = self.env.ref(name)
if o._name == self._name:
res += o.name_get()
except:
pass
if not res:
res = super(AccountAccountType, self).name_search(
name=name, args=args, operator=operator, limit=limit)
return res


class ResPartner(models.Model):
Expand All @@ -11,7 +31,7 @@ class ResPartner(models.Model):
property_account_income = fields.Many2one(
'account.account',
string='Default Income Account',
domain='''[('user_type_id', '=', 'Income')]''',
domain="[('user_type_id', '=', 'account.data_account_type_revenue')]",
help='Default counterpart account for sales on invoice lines',
company_dependent=True)
auto_update_account_income = fields.Boolean(
Expand All @@ -22,7 +42,7 @@ class ResPartner(models.Model):
property_account_expense = fields.Many2one(
'account.account',
string='Default Expense Account',
domain='''[('user_type_id', '=', 'Expenses')]''',
domain="[('user_type_id', '=', 'account.data_account_type_expenses')]",
help='Default counterpart account for purchases on invoice lines',
company_dependent=True)
auto_update_account_expense = fields.Boolean(
Expand Down

0 comments on commit 42608c4

Please sign in to comment.