bzr revid: apa@tinyerp.com-20101028114513-r0zu13b6fwgsfq4o
This commit is contained in:
apa-tiny
2010-10-28 17:15:13 +05:30
17 changed files with 46 additions and 54 deletions
+2 -11
View File
@@ -80,17 +80,8 @@ class account_payment_term(osv.osv):
if amt:
next_date = (datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days))
if line.days2 < 0:
nyear = next_date.strftime("%Y")
nmonth = str(int(next_date.strftime("%m"))% 12+1)
nday = "1"
ndate = "%s-%s-%s" % (nyear, nmonth, nday)
nseconds = time.mktime(time.strptime(ndate, '%Y-%m-%d'))
next_month = datetime.fromtimestamp(nseconds)
delta = timedelta(seconds=1)
next_date = next_month - delta
next_date = next_date + relativedelta(days=line.days2)
next_first_date = next_date + relativedelta(day=1,months=1) #Getting 1st of next month
next_date = next_first_date + relativedelta(days=line.days2)
if line.days2 > 0:
next_date += relativedelta(day=line.days2, months=1)
result.append( (next_date.strftime('%Y-%m-%d'), amt) )
+1 -2
View File
@@ -328,8 +328,7 @@ class account_cash_statement(osv.osv):
statement_pool = self.pool.get('account.bank.statement')
for statement in statement_pool.browse(cr, uid, ids, context=context):
vals = {}
force_allow = context.get('force_allow',False)
if not force_allow and not self._user_allow(cr, uid, statement.id, context=context):
if not self._user_allow(cr, uid, statement.id, context=context):
raise osv.except_osv(_('Error !'), _('User %s does not have rights to access %s journal !' % (statement.user_id.name, statement.journal_id.name)))
if statement.name and statement.name == '/':
@@ -26,7 +26,7 @@
I clicked on Open CashBox button to open the cashbox
-
!python {model: account.bank.statement}: |
self.button_open(cr, uid, [ref("account_bank_statement_1")], {"force_allow":True, "lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
self.button_open(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
-
I check that now bank statement is in the "Open" state
@@ -26,6 +26,7 @@ import report
from osv import fields, osv, orm
import tools
from tools.translate import _
import addons
class module(osv.osv):
_inherit = 'ir.module.module'
@@ -104,7 +105,7 @@ class module(osv.osv):
context.update({'level': 1})
dots = self.get_graphical_representation(cr, uid, object_ids, context=context)
# todo: use os.realpath
file_path = tools.config['addons_path']+"/base_module_doc_rst/"
file_path = addons.get_module_resource('base_module_doc_rst')
path_png = file_path + "/module.png"
for key, val in dots.items():
path_dotfile = file_path + "/%s.dot" % (key,)
@@ -24,7 +24,7 @@ import os
from osv import fields, osv
from tools.translate import _
import pooler
from tools import config
import addons
from base_module_quality import base_module_quality
class quality_test(base_module_quality.abstract_quality_check):
@@ -45,7 +45,7 @@ This test checks the Unit Test(PyUnit) Cases of the module. Note that 'unit_test
def run_test(self, cr, uid, module_path):
pool = pooler.get_pool(cr.dbname)
module_name = module_path.split('/')[-1]
test_file = config['addons_path'] +'/' + module_name +'/unit_test/test.py'
test_file = addons.get_module_resource(module_name) + '/unit_test/test.py'
if not os.path.isfile(test_file):
self.result += _("Module does not have 'unit_test/test.py' file")
return None
+1 -1
View File
@@ -64,7 +64,7 @@ class crm_helpdesk(crm.crm_case, osv.osv):
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.helpdesk')]"),
'duration': fields.float('Duration'),
'duration': fields.float('Duration', states={'done': [('readonly', True)]}),
'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\
+3 -2
View File
@@ -24,6 +24,7 @@ import os
from osv import fields, osv
import tools
from tools.translate import _
import addons
import addons
@@ -182,8 +183,8 @@ class hr_employee(osv.osv):
return {'value': {'work_email' : work_email}}
def _get_photo(self, cr, uid, context=None):
res_path = addons.get_module_resource("hr","image/photo.png")
return open(res_path,'rb').read().encode('base64')
photo_path = addons.get_module_resource('hr','image','photo.png')
return open(photo_path, 'rb').read().encode('base64')
_defaults = {
'active': 1,
@@ -7,7 +7,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="My Timesheet">
<separator string="It will open the your current timesheet" colspan="4" />
<separator string="It will open your current timesheet" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="terp-camera_test" name="open_timesheet" string="Open" type="object"/>
+2 -2
View File
@@ -21,7 +21,7 @@
from osv import fields
from osv import osv
from tools import config
import addons
import base64
@@ -32,7 +32,7 @@ class outlook_installer(osv.osv_memory):
def default_get(self, cr, uid, fields, context={}):
data = super(outlook_installer, self).default_get(cr, uid, fields, context)
data['doc_file'] = 'http://doc.openerp.com/book/2/2_6_Comms/2_6_Comms_outlook.html'
file = open(config['addons_path'] + "/outlook/plugin/openerp-outlook-plugin.zip", 'r')
file = open(addons.get_module_resource('outlook','plugin','openerp-outlook-plugin.zip'), 'r')
data['plugin_file'] = base64.encodestring(file.read())
return data
@@ -57,6 +57,7 @@ class account_cash_statement(osv.osv):
res = False
uids = []
statement = self.browse(cr, uid, statement_id, context=context)
if (not statement.journal_id.journal_users) and uid == 1: return True
for user in statement.journal_id.journal_users:
uids.append(user.id)
if uid in uids:
@@ -93,4 +94,4 @@ class account_cash_statement(osv.osv):
account_cash_statement()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+1 -1
View File
@@ -35,7 +35,7 @@
<field name="password">jth</field>
</record>
<record id="res_users_tester" model="res.users">
<field name="name">Alien</field>
<field name="name">Aline</field>
<field eval="[(6, 0, [ref('base.group_user'), ref('project.group_project_user')])]" name="groups_id"/>
<field name="login">apr</field>
<field name="password">apr</field>
+2 -2
View File
@@ -54,8 +54,8 @@ At the end of the month, the planning manager can also check if the encoded time
'project_planning_demo.xml',
],
'test': [
'test/planning_states.yml'
'test/planning_report.yml'
'test/planning_states.yml',
'test/project_planning_report.yml'
],
'installable': True,
'active': False,
@@ -27,7 +27,7 @@
<field name="arch" type="xml">
<xpath expr='//filter[@string="Member"]' position='after'>
<separator orientation="vertical"/>
<filter icon="terp-camera_test" string="Invoiceble" domain="[('to_invoice','!=', False)]" help="Invoiceable Project"/>
<filter icon="terp-camera_test" string="Invoiceable" domain="[('to_invoice','!=', False)]" help="Invoiceable Project"/>
</xpath>
</field>
</record>
+2 -2
View File
@@ -40,7 +40,7 @@ import netsvc
import pooler
from report_helper import WebKitHelper
from report.report_sxw import *
from tools.config import config
import addons
from tools.translate import _
from osv.osv import except_osv
@@ -225,7 +225,7 @@ class WebKitParser(report_sxw):
template = False
if report_xml.report_file :
path = os.path.join(config['addons_path'], report_xml.report_file)
path = addons.get_module_resource(report_xml.report_file)
if os.path.exists(path) :
template = file(path).read()
if not template and report_xml.report_webkit_data :
+11 -12
View File
@@ -1,21 +1,20 @@
# -*- encoding: utf-8 -*-
## -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -30,6 +29,7 @@ from osv import osv
from osv import fields
from tools import to_xml
from tools.translate import _
import addons
class survey_question_wiz(osv.osv_memory):
_name = 'survey.question.wiz'
@@ -400,7 +400,7 @@ class survey_question_wiz(osv.osv_memory):
context.update({'response_id':response_id})
report = self.create_report(cr, uid, [int(survey_id)], 'report.survey.browse.response', survey_data.title,context)
attachments = []
file = open(tools.config['addons_path'] + '/survey/report/' + survey_data.title + ".pdf")
file = open(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")
file_data = ""
while 1:
line = file.readline()
@@ -410,7 +410,7 @@ class survey_question_wiz(osv.osv_memory):
attachments.append((survey_data.title + ".pdf",file_data))
file.close()
os.remove(tools.config['addons_path'] + '/survey/report/' + survey_data.title + ".pdf")
os.remove(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")
user_email = False
resp_email = False
@@ -455,10 +455,9 @@ class survey_question_wiz(osv.osv_memory):
if not report_name or not res_ids:
return (False, Exception('Report name and Resources ids are required !!!'))
try:
ret_file_name = tools.config['addons_path'] + '/survey/report/' + file_name + '.pdf'
service = netsvc.LocalService(report_name);
(result, format) = service.create(cr, uid, res_ids, {}, context)
fp = open(ret_file_name, 'wb+');
fp = open(addons.get_module_resource('survey', 'report') + file_name + '.pdf', 'wb+');
fp.write(result);
fp.close();
+12 -12
View File
@@ -1,22 +1,21 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU Affero General Public License for more details
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
@@ -32,6 +31,7 @@ from osv import osv
import tools
from tools.translate import _
import netsvc
import addons
class survey_send_invitation(osv.osv_memory):
@@ -79,7 +79,7 @@ class survey_send_invitation(osv.osv_memory):
if not report_name or not res_ids:
return (False, Exception('Report name and Resources ids are required !!!'))
try:
ret_file_name = tools.config['addons_path'] + '/survey/report/' + file_name + '.pdf'
ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf'
service = netsvc.LocalService(report_name);
(result, format) = service.create(cr, uid, res_ids, {}, {})
fp = open(ret_file_name, 'wb+');
@@ -122,7 +122,7 @@ class survey_send_invitation(osv.osv_memory):
new_user.append(use.id)
for id in survey_ref.browse(cr, uid, survey_ids):
report = self.create_report(cr, uid, [id.id], 'report.survey.form', id.title)
file = open(tools.config['addons_path'] + '/survey/report/' + id.title +".pdf")
file = open(addons.get_module_resource('survey', 'report') + id.title +".pdf")
file_data = ""
while 1:
line = file.readline()
@@ -131,7 +131,7 @@ class survey_send_invitation(osv.osv_memory):
break
attachments.append((id.title +".pdf",file_data))
file.close()
os.remove(tools.config['addons_path'] + '/survey/report/' + id.title + ".pdf")
os.remove(addons.get_module_resource('survey', 'report') + id.title +".pdf")
for partner in self.pool.get('res.partner').browse(cr, uid, partner_ids):
for addr in partner.address: