This question has been flagged
1 Reply
3007 Views

Hi In Odoo 8 I am trying to build a module.


I have this:

__init__.py:

from . import vrijeme_racun



__openerp__.py:

{

'name': 'Vrijeme Racun',

'version': '1.0',

'category': 'Tools',

'summary': 'Vrijeme, Racun',

'description': """

Vrijeme za racune

================================

Dodaje vrijeme na racun.

""",

'depends' : ['base'],

'data' : [],

'images': [],

'demo': [],

'installable' : True,

'application': True,

}


vrijeme_racun.pj:

from openerp import models, fields, api

class override_date_invoice(models.Model):

_inherit = 'account.invoice'

date_invoice = fields.Datetime(string = 'Invoice Date', readonly = True, states = {'draft': [('readonly', False)]}, index=True,help=’Keep empty to use the current date’,copy = False)


When trying to install I get error:


File "/var/lib/odoo/.local/share/Odoo/addons/8.0/vrijeme_racun/__init__.py", line 1, in <module>

from . import vrijeme_racun

ImportError: cannot import name vrijeme_racun

 


I am new at this so if you can help.Thanks

Avatar
Discard
Best Answer

in __init__ try:
import vrijeme_racun   (instead from . import ...)

check file name : vrijeme_racun.pj should be vrijeme_racun.py (this might be a typo here)

also.. in file class should be account_invoice , not override_date_invoice

in __openerp__.py :
application: False  (cause this is just a modification not a real app module!)

and a suggestion... 
leave date_invoice as is, and simply add new field date_validate : fields.datetime

(HR lokalizacija trazi jos dosta toga ..) 



Avatar
Discard
Author

It works but it does not add date to invoice as it should?

it ads datetime, but time is all zeroes :) ? well then you need to override one more method in account_invoice class in order to write current time of validating the invoice or add new method to confirm_invoice workflow...

Author

Can you maybe help with this? Because I am not sure what to do next