Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Creating module problem

By
Marin
on 7/8/15, 8:00 AM 490 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

1

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

there is only 10 kind of people the ones that understand binary ... and others

Bole
On 7/8/15, 8:10 AM

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 ..) 



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

Marin
on 7/8/15, 8:26 AM

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...

Bole
on 7/8/15, 8:49 AM

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

Marin
on 7/8/15, 9:05 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/8/15, 8:00 AM
Seen: 490 times
Last updated: 7/8/15, 8:10 AM