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:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
5659
Lượt xem
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 1 20
|
14973 | ||
|
1
thg 4 25
|
3665 | ||
|
3
thg 12 22
|
11575 | ||
How to get current url from bowser?
Đã xử lý
|
|
5
thg 4 24
|
42130 | |
|
6
thg 4 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()