This question has been flagged
1 Reply
4755 Views

Hi all,

I am trying to make a v7 module to work on v8.

It's almost everything ready except that I get an error when the system reads a specific class.

The error is:

File "/home/odoo/custom/addons/account_mode/__init__.py", line 29, in <module> import account_invoice

File "/home/odoo/custom/addons/account_mode/account_invoice.py", line 48, in <module> class account_payment_mode(osv.osv):

File "/home/odoo/custom/addons/account_mode/account_invoice.py", line 56, in account_payment_mode string='Money Sale Account',  method=True, view_load=True),

TypeError: __init__() takes exactly 1 argument (7 given)

The code for the class:

class account_payment_mode(osv.osv):
    _name = 'account.payment.mode'
    _description = 'Payment Mode'
    _columns = {
        'name': fields.char('Payment Mode', size=32, required=True, translate=True),
        'description': fields.text('Description'),
        'property_account_money_sale': fields.property('account.account',
            type='many2one', relation='account.account',
            string='Money Sale Account', method=True, view_load=True),
    }

Anyone can help?

Thank you all

Paulo

 

Avatar
Discard

Did you get sorted wit this issue ?

Best Answer

In v8 you should use class account_payment_mode(orm.Model) instead of osv.osv.  The latter has been deprecated.

Avatar
Discard
Author

Thank you Ivan. Should the remmaining code still as it is? Is there any additional change to be made on the remmaing code?

Sorry, I missed the fact that the log pointed to the definition of property_account_money_sale column. Property field does not accept method=True attribute. Take that away.

Author

Thank you Ivan. I will check that too and will update you soon.