I created a text file in the same directory as models.py and wrote a file opening and reading code in models.py to open and append to the file content. But the file stays empty. my code work well as python script, but not within odoo. Help please.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- Müşteri İlişkileri Yönetimi
- e-Commerce
- Muhasebe
- Envanter
- PoS
- Project
- MRP
Bu soru işaretlendi
5661
Görünümler
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Olİlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
---|---|---|---|---|
|
1
Oca 20
|
14974 | ||
|
1
Nis 25
|
3665 | ||
|
3
Ara 22
|
11575 | ||
|
5
Nis 24
|
42130 | ||
|
6
Nis 24
|
38989 |
did you create the file with script or manual. if you did it manual and you're on linux look at the file owner and permissions.
Can you paste the code?
from datetime import timedelta, date, datetime
import pytz
from openerp import models, fields, api, _, tools
from openerp.exceptions import Warning
from openerp.osv import osv, fields, orm
from pyimppn import imppn_line
import psycopg2
import os
import logging
_logger = logging.getLogger(__name__)
class companyimppn(models.Model):
_inherit = 'res.company'
x_teamsystemid = fields.integer(string='Teamsystem id')
class view(osv.osv):
_inherit = ['ir.ui.view']
def __init__(self, pool, cr):
super(view, self).__init__(pool, cr)
super(view, self)._columns['type'].selection.append(('odooimppnview','OdooimppnView'))
class odooimppn(models.Model):
_name = 'odoo_imppn.content'
_description = 'Odoo imppn content'
def testing(self):
results = "this is a test to see if we are able to write on a text file located inside the module"
path = os.path.expanduser('./etc/odoo/addons/odoo_imppn/IMPPN_tests.txt')
# path = os.path.expanduser('./home/mounirlahsini/Downloads/IMPPN_tests.txt')
fileIMPPN = open(path, 'r+')
fileIMPPN.write(results)
fileIMPPN.close()