[IMP] various: use odoo for imports instead of openerp and update class names

This commit is contained in:
Thibault Delavallée
2016-08-10 15:48:07 +02:00
parent 5ce159924c
commit c8a313d51e
197 changed files with 695 additions and 542 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
from odoo import api, fields, models
class AccountMove(models.Model):
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
from odoo import api, fields, models
class ProductTemplate(models.Model):
@@ -2,9 +2,9 @@
import base64
from openerp import api, fields, models, _
from openerp.exceptions import UserError
from openerp.addons.base.res.res_bank import sanitize_account_number
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.addons.base.res.res_bank import sanitize_account_number
import logging
_logger = logging.getLogger(__name__)
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from odoo import models, fields, api
class AccountJournal(models.Model):
_inherit = "account.journal"
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models
from odoo import api, fields, models
class account_bank_statement_import_journal_creation(models.TransientModel):
class AccountBankStatementImportJounalCreation(models.TransientModel):
_name = 'account.bank.statement.import.journal.creation'
_description = 'Import Bank Statement Journal Creation Wizard'
+2 -1
View File
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.addons.account.tests.account_test_classes import AccountingTestCase
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
import time
class TestAccountBudgetCommon(AccountingTestCase):
def setUp(self):
@@ -100,7 +100,7 @@ if res:
<field name="name">Test 6 : Invoices status</field>
<field name="desc">Check that paid/reconciled invoices are not in 'Open' state</field>
<field name="code_exec"><![CDATA[
from openerp import _
from odoo import _
res = []
column_order = ['number','id','name','state']
if reconciled_inv():
@@ -7,7 +7,7 @@ import time
import uuid
from odoo import api, fields, models, tools, _
from openerp.exceptions import UserError, ValidationError
from odoo.exceptions import UserError, ValidationError
_logger = logging.getLogger(__name__)
@@ -3,8 +3,8 @@
import json
import urllib
from openerp import api, fields, models, tools, _
from openerp.exceptions import UserError
from odoo import api, fields, models, tools, _
from odoo.exceptions import UserError
def geo_find(addr):
+8 -7
View File
@@ -1,17 +1,18 @@
# -*- coding: utf-8 -*-
import openerp
from openerp.http import request
from openerp.addons.bus.models.bus import dispatch
from odoo import exceptions
from odoo.http import Controller, request, route
from odoo.addons.bus.models.bus import dispatch
class BusController(openerp.http.Controller):
class BusController(Controller):
""" Examples:
openerp.jsonRpc('/longpolling/poll','call',{"channels":["c1"],last:0}).then(function(r){console.log(r)});
openerp.jsonRpc('/longpolling/send','call',{"channel":"c1","message":"m1"});
openerp.jsonRpc('/longpolling/send','call',{"channel":"c2","message":"m2"});
"""
@openerp.http.route('/longpolling/send', type="json", auth="public")
@route('/longpolling/send', type="json", auth="public")
def send(self, channel, message):
if not isinstance(channel, basestring):
raise Exception("bus.Bus only string channels are allowed.")
@@ -26,7 +27,7 @@ class BusController(openerp.http.Controller):
request._cr = None
return dispatch.poll(dbname, channels, last, options)
@openerp.http.route('/longpolling/poll', type="json", auth="public")
@route('/longpolling/poll', type="json", auth="public")
def poll(self, channels, last, options=None):
if options is None:
options = {}
@@ -35,5 +36,5 @@ class BusController(openerp.http.Controller):
if [c for c in channels if not isinstance(c, basestring)]:
raise Exception("bus.Bus only string channels are allowed.")
if request.registry.in_test_mode():
raise openerp.exceptions.UserError("bus.Bus not available in test mode")
raise exceptions.UserError("bus.Bus not available in test mode")
return self._poll(request.db, channels, last, options)
+4 -5
View File
@@ -2,11 +2,10 @@
import datetime
import time
from openerp import api, fields, models
from openerp import tools
from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.addons.bus.models.bus import TIMEOUT
from odoo import api, fields, models
from odoo import tools
from odoo.addons.bus.models.bus import TIMEOUT
from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
DISCONNECTION_TIMER = TIMEOUT + 5
AWAY_TIMER = 1800 # 30 minutes
+3 -3
View File
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models
from openerp.addons.bus.models.bus_presence import AWAY_TIMER
from openerp.addons.bus.models.bus_presence import DISCONNECTION_TIMER
from odoo import api, fields, models
from odoo.addons.bus.models.bus_presence import AWAY_TIMER
from odoo.addons.bus.models.bus_presence import DISCONNECTION_TIMER
class ResPartner(models.Model):
+3 -3
View File
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models
from openerp.addons.bus.models.bus_presence import AWAY_TIMER
from openerp.addons.bus.models.bus_presence import DISCONNECTION_TIMER
from odoo import api, fields, models
from odoo.addons.bus.models.bus_presence import AWAY_TIMER
from odoo.addons.bus.models.bus_presence import DISCONNECTION_TIMER
class ResUsers(models.Model):
+4 -3
View File
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*
import openerp
from openerp.http import request
from odoo.addons.bus.controllers.main import BusController
from odoo.http import request
class CalendarBusController(openerp.addons.bus.controllers.main.BusController):
class CalendarBusController(BusController):
# --------------------------
# Extends BUS Controller Poll
# --------------------------
+3 -3
View File
@@ -2,9 +2,9 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo
from odoo import api, models, SUPERUSER_ID
from openerp.http import request
from openerp.api import Environment
from odoo import models, SUPERUSER_ID
from odoo.http import request
from odoo.api import Environment
from werkzeug.exceptions import BadRequest
+6 -4
View File
@@ -1,9 +1,11 @@
import openerp.tests
# Part of Odoo. See LICENSE file for full copyright and licensing details.
@openerp.tests.common.at_install(False)
@openerp.tests.common.post_install(True)
class TestUi(openerp.tests.HttpCase):
import odoo.tests
@odoo.tests.common.at_install(False)
@odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase):
def test_01_crm_tour(self):
self.phantom_js("/web", "odoo.__DEBUG__.services['web_tour.tour'].run('crm_tour')", "odoo.__DEBUG__.services['web_tour.tour'].tours.crm_tour", login="admin")
+2 -1
View File
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models
from odoo import api, fields, models
class CrmLeadLost(models.TransientModel):
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from openerp.tests import common
from odoo.tests import common
class TestFloatExport(common.TransactionCase):
+4 -3
View File
@@ -2,9 +2,10 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from openerp import api, fields, models, _
from openerp.exceptions import UserError, ValidationError
from openerp.tools.safe_eval import safe_eval as eval
from odoo import api, fields, models, _
from odoo.exceptions import UserError, ValidationError
from odoo.tools.safe_eval import safe_eval as eval
_logger = logging.getLogger(__name__)
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields, api
import openerp.addons.decimal_precision as dp
from odoo import models, fields, api
import odoo.addons.decimal_precision as dp
class PriceRule(models.Model):
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import fields, models
from odoo import fields, models
class ResPartner(models.Model):
+2 -1
View File
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields
from odoo import models, fields
class ProductPackaging(models.Model):
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, models, fields
from odoo import api, models, fields
class ProductTemplate(models.Model):
+3 -3
View File
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields, api, _
from openerp.exceptions import UserError
import openerp.addons.decimal_precision as dp
from odoo import models, fields, api, _
from odoo.exceptions import UserError
import odoo.addons.decimal_precision as dp
class SaleOrder(models.Model):
+2 -2
View File
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
from odoo import api, fields, models
import openerp.addons.decimal_precision as dp
import odoo.addons.decimal_precision as dp
class StockMove(models.Model):
+3 -3
View File
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields, api, _
from openerp.exceptions import UserError
from odoo import models, fields, api, _
from odoo.exceptions import UserError
import openerp.addons.decimal_precision as dp
import odoo.addons.decimal_precision as dp
class StockQuantPackage(models.Model):
+2 -2
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from openerp.tests import common
from openerp.tools import float_compare
from odoo.tests import common
from odoo.tools import float_compare
class TestDeliveryCost(common.TransactionCase):
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from openerp.addons.account.tests.account_test_classes import AccountingTestCase
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
class StockMoveInvoice(AccountingTestCase):
+11 -10
View File
@@ -2,11 +2,12 @@
import pytz
from openerp import _, api, fields, models
from openerp.exceptions import AccessError, UserError, ValidationError
from openerp.tools.translate import html_translate
from odoo import _, api, fields, models
from odoo.exceptions import AccessError, UserError, ValidationError
from odoo.tools.translate import html_translate
class event_type(models.Model):
class EventType(models.Model):
""" Event Type """
_name = 'event.type'
_description = 'Event Type'
@@ -21,7 +22,7 @@ class event_type(models.Model):
help="It will select this default maximum value when you choose this event")
class event_event(models.Model):
class EventEvent(models.Model):
"""Event"""
_name = 'event.event'
_description = 'Event'
@@ -207,7 +208,7 @@ class event_event(models.Model):
@api.model
def create(self, vals):
res = super(event_event, self).create(vals)
res = super(EventEvent, self).create(vals)
if res.organizer_id:
res.message_subscribe([res.organizer_id.id])
if res.auto_confirm:
@@ -216,7 +217,7 @@ class event_event(models.Model):
@api.multi
def write(self, vals):
res = super(event_event, self).write(vals)
res = super(EventEvent, self).write(vals)
if vals.get('organizer_id'):
self.message_subscribe([vals['organizer_id']])
return res
@@ -263,7 +264,7 @@ class event_event(models.Model):
self.env['mail.template'].browse(template_id).send_mail(attendee.id, force_send=force_send)
class event_registration(models.Model):
class EventRegistration(models.Model):
_name = 'event.registration'
_description = 'Attendee'
_inherit = ['mail.thread', 'ir.needaction_mixin']
@@ -311,7 +312,7 @@ class event_registration(models.Model):
@api.model
def create(self, vals):
registration = super(event_registration, self).create(vals)
registration = super(EventRegistration, self).create(vals)
if registration._check_auto_confirmation():
registration.sudo().confirm_registration()
return registration
@@ -372,7 +373,7 @@ class event_registration(models.Model):
@api.multi
def message_get_suggested_recipients(self):
recipients = super(event_registration, self).message_get_suggested_recipients()
recipients = super(EventRegistration, self).message_get_suggested_recipients()
try:
for attendee in self:
if attendee.partner_id:
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, models, fields
from openerp import tools
from odoo import api, models, fields
from odoo import tools
class report_event_registration(models.Model):
class ReportEventRegistration(models.Model):
"""Events Analysis"""
_name = "report.event.registration"
_order = 'event_date desc'
+2 -1
View File
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
from openerp.addons.event.tests import test_event_flow, test_mail_schedule
from . import test_event_flow, test_mail_schedule
+1 -4
View File
@@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
from dateutil.relativedelta import relativedelta
from openerp import fields
from openerp.tests import common
from odoo.tests import common
class TestEventCommon(common.TransactionCase):
+3 -3
View File
@@ -3,9 +3,9 @@
import datetime
from dateutil.relativedelta import relativedelta
from openerp.addons.event.tests.common import TestEventCommon
from openerp.exceptions import AccessError, ValidationError, UserError
from openerp.tools import mute_logger
from odoo.addons.event.tests.common import TestEventCommon
from odoo.exceptions import ValidationError, UserError
from odoo.tools import mute_logger
class TestEventFlow(TestEventCommon):
+3 -3
View File
@@ -3,9 +3,9 @@
import datetime
from dateutil.relativedelta import relativedelta
from openerp import fields, tools
from openerp.addons.event.tests.common import TestEventCommon
from openerp.tools import mute_logger
from odoo import fields, tools
from odoo.addons.event.tests.common import TestEventCommon
from odoo.tools import mute_logger
class TestMailSchedule(TestEventCommon):
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, api
from odoo import models, api
class event_confirm(models.TransientModel):
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from odoo import models, fields, api
class SaleOrderEventRegistration(models.TransientModel):
class RegistrationEditor(models.TransientModel):
_name = "registration.editor"
sale_order_id = fields.Many2one('sale.order', 'Sale Order', required=True)
@@ -11,7 +11,7 @@ class SaleOrderEventRegistration(models.TransientModel):
@api.model
def default_get(self, fields):
res = super(SaleOrderEventRegistration, self).default_get(fields)
res = super(RegistrationEditor, self).default_get(fields)
if not res.get('sale_order_id'):
sale_order_id = res.get('sale_order_id', self._context.get('active_id'))
res['sale_order_id'] = sale_order_id
+2
View File
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class Partner(models.Model):
_inherit = ['res.partner']
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, models
from openerp.tools import float_compare
from odoo import api, models
from odoo.tools import float_compare
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import fields, models
from odoo import fields, models
class HrDepartment(models.Model):
+2 -1
View File
@@ -6,7 +6,8 @@ import re
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools import email_split
import openerp.addons.decimal_precision as dp
import odoo.addons.decimal_precision as dp
class HrExpense(models.Model):
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
from odoo import api, fields, models
class ProductTemplate(models.Model):
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models
from openerp import SUPERUSER_ID
class HrExpenseConfigSettings(models.TransientModel):
_name = 'hr.expense.config.settings'
+2 -1
View File
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from openerp import api, models
from odoo import api, models
class PlannerHrExpense(models.Model):
+4 -1
View File
@@ -1,4 +1,7 @@
from openerp.tests.common import TransactionCase
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests.common import TransactionCase
class TestCheckJournalEntry(TransactionCase):
@@ -2,7 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from openerp.exceptions import ValidationError
from odoo.exceptions import ValidationError
class HrExpenseRegisterPaymentWizard(models.TransientModel):
@@ -5,9 +5,8 @@ import time
from datetime import datetime, timedelta
from dateutil import relativedelta
from odoo import fields, tools
from openerp.addons.account.tests.account_test_classes import AccountingTestCase
from odoo import fields, tools
from odoo.modules.module import get_module_resource
from odoo.tests import common
@@ -15,7 +14,8 @@ from odoo.tests import common
class TestHrPayrollAccount(common.TransactionCase):
def _load(self, module, *args):
tools.convert_file(self.cr, 'hr_payroll_account',
tools.convert_file(
self.cr, 'hr_payroll_account',
get_module_resource(module, *args), {}, 'init', False, 'test', self.registry._assertion_report)
def setUp(self):
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models
from odoo import api, fields, models
class HrDepartment(models.Model):
+2 -2
View File
@@ -1,9 +1,9 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
from odoo import api, fields, models
class hr_employee(models.Model):
class HrEmployee(models.Model):
_inherit = "hr.employee"
newly_hired_employee = fields.Boolean('Newly hired employee', compute='_compute_newly_hired_employee',
+1 -1
View File
@@ -1,6 +1,6 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import _, api, fields, models
from odoo import api, fields, models
class Job(models.Model):
@@ -3,9 +3,9 @@
from datetime import datetime
from openerp import api, fields, models, tools
from openerp.tools.translate import _
from openerp.exceptions import UserError
from odoo import api, fields, models, tools
from odoo.tools.translate import _
from odoo.exceptions import UserError
AVAILABLE_PRIORITIES = [
('0', 'Normal'),
@@ -460,7 +460,7 @@ class Applicant(models.Model):
self.write({'active': True, 'stage_id': default_stage_id})
class applicant_category(models.Model):
class ApplicantCategory(models.Model):
_name = "hr.applicant.category"
_description = "Category of applicant"
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
from odoo import fields, models
class RecruitmentSettings(models.TransientModel):
@@ -9,6 +9,6 @@ class RecruitmentSettings(models.TransientModel):
_inherit = ['res.config.settings']
module_document = fields.Selection(selection=[
(0, "Do not manage CVs and motivation letter"),
(1, 'Allow the automatic indexation of resumes')
], string='Resumes')
(0, "Do not manage CVs and motivation letter"),
(1, 'Allow the automatic indexation of resumes')
], string='Resumes')
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import fields, models, tools
from ..models import hr_recruitment
from odoo import fields, models, tools
from odoo.addons.hr_recruitment.models import hr_recruitment
class hr_recruitment_report(models.Model):
class HrRecruitmentReport(models.Model):
_name = "hr.recruitment.report"
_description = "Recruitments Statistics"
_auto = False
+1 -1
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields, api
from odoo import api, fields, models
class AccountAnalyticLine(models.Model):
+5 -4
View File
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, fields, api
from openerp.osv import osv
from odoo import models, fields, api
from odoo.osv import osv
class Project(models.Model):
_inherit = "project.project"
subtask_project_id = fields.Many2one('project.project', string='Sub-task Project', help="Choosing a sub-tasks project will both enable sub-tasks and set their default project (possibly the project itself)",
ondelete="restrict")
subtask_project_id = fields.Many2one(
'project.project', string='Sub-task Project', ondelete="restrict",
help="Choosing a sub-tasks project will both enable sub-tasks and set their default project (possibly the project itself)")
class Task(models.Model):
+6 -7
View File
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from dateutil.relativedelta import relativedelta
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields,osv
from openerp import tools
from odoo.osv import fields, osv
class report_project_task_user(osv.Model):
class ReportProjectTaskUser(osv.Model):
_inherit = "report.project.task.user"
_columns = {
'hours_planned': fields.float('Planned Hours', readonly=True),
@@ -17,7 +16,7 @@ class report_project_task_user(osv.Model):
}
def _select(self):
return super(report_project_task_user, self)._select() + ", progress as progress, t.effective_hours as hours_effective, remaining_hours as remaining_hours, total_hours as total_hours, t.delay_hours as hours_delay, planned_hours as hours_planned"
return super(ReportProjectTaskUser, self)._select() + ", progress as progress, t.effective_hours as hours_effective, remaining_hours as remaining_hours, total_hours as total_hours, t.delay_hours as hours_delay, planned_hours as hours_planned"
def _group_by(self):
return super(report_project_task_user, self)._group_by() + ", remaining_hours, t.effective_hours, progress, total_hours, planned_hours, hours_delay"
return super(ReportProjectTaskUser, self)._group_by() + ", remaining_hours, t.effective_hours, progress, total_hours, planned_hours, hours_delay"
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import fields, models
from odoo import fields, models
class TimesheetAttendance(models.Model):
+7 -4
View File
@@ -1,10 +1,13 @@
# -*- coding: utf-8 -*-
from openerp import http, _
from openerp.http import request
from openerp.addons.base.ir.ir_qweb import AssetsBundle
from openerp.addons.web.controllers.main import binary_content
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
from odoo import http, _
from odoo.http import request
from odoo.addons.base.ir.ir_qweb import AssetsBundle
from odoo.addons.web.controllers.main import binary_content
class LivechatController(http.Controller):
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
import json
import openerp
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import random
import re
from datetime import datetime, timedelta
from openerp import api, fields, models
from openerp import tools
from odoo import api, fields, models, modules, tools
class ImLivechatChannel(models.Model):
@@ -20,7 +19,7 @@ class ImLivechatChannel(models.Model):
_description = 'Livechat Channel'
def _default_image(self):
image_path = openerp.modules.get_module_resource('im_livechat', 'static/src/img', 'default.png')
image_path = modules.get_module_resource('im_livechat', 'static/src/img', 'default.png')
return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
def _default_user_ids(self):
+3 -1
View File
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class ChannelPartner(models.Model):
+3 -1
View File
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from openerp import api, models
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class Rating(models.Model):
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models, tools
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, tools
class ImLivechatReportChannel(models.Model):
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models, tools
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, tools
class ImLivechatReportOperator(models.Model):
@@ -1,6 +1,9 @@
from openerp.modules.registry import RegistryManager
# -*- coding: utf-8 -*-
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
from odoo.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
migrate_set_tags_and_taxes_updatable(cr, registry, 'l10n_at')
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,7 +1,7 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
from odoo.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
migrate_set_tags_and_taxes_updatable(cr, registry, 'l10n_ch')
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
from odoo.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
migrate_set_tags_and_taxes_updatable(cr, registry, 'l10n_cl')
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
from odoo.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
migrate_set_tags_and_taxes_updatable(cr, registry, 'l10n_de_skr03')
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
from odoo.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
migrate_set_tags_and_taxes_updatable(cr, registry, 'l10n_de_skr04')
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
from odoo.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
migrate_set_tags_and_taxes_updatable(cr, registry, 'l10n_hr')
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,6 +1,6 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
from odoo.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
migrate_set_tags_and_taxes_updatable(cr, registry, 'l10n_in')
@@ -1,7 +1,7 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,7 +1,7 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_tags_on_taxes
from odoo.addons.account.models.chart_template import migrate_tags_on_taxes
migrate_tags_on_taxes(cr, registry)
@@ -1,7 +1,7 @@
from openerp.modules.registry import RegistryManager
from odoo.modules.registry import RegistryManager
def migrate(cr, version):
registry = RegistryManager.get(cr.dbname)
from openerp.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
from odoo.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
migrate_set_tags_and_taxes_updatable(cr, registry, 'l10n_nl')
+5 -3
View File
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import werkzeug
from openerp import http
from openerp.http import request
from odoo import http
from odoo.http import request
class link_tracker(http.Controller):
class LinkTracker(http.Controller):
@http.route('/r/<string:code>', type='http', auth='none', website=True)
def full_url_redirect(self, code, **post):
request.env['link.tracker.click'].add_click(code, request.httprequest.remote_addr, request.session['geoip'].get('country_code'), stat_id=False)
+4 -2
View File
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
import random
import re
@@ -10,8 +12,8 @@ from urlparse import urljoin
from urlparse import urlparse
from werkzeug import url_encode
from openerp import models, fields, api, _
from openerp.tools import ustr
from odoo import models, fields, api, _
from odoo.tools import ustr
URL_REGEX = r'(\bhref=[\'"](?!mailto:)([^\'"]+)[\'"])'
+4 -3
View File
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
from openerp import models, fields, api, _
import openerp.addons.decimal_precision as dp
from openerp.exceptions import AccessError, ValidationError
from odoo import api, fields, models, _
from odoo.exceptions import AccessError, ValidationError
import odoo.addons.decimal_precision as dp
class LunchOrder(models.Model):
+2 -1
View File
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.tests import common
from odoo.tests import common
class Test_Lunch(common.TransactionCase):
+9 -7
View File
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models, _
import random
from openerp.exceptions import UserError
class lunch_order_line(models.TransientModel):
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class LunchOrderLineLucky(models.TransientModel):
_name = 'lunch.order.line.lucky'
def _default_supplier(self):
@@ -16,7 +18,7 @@ class lunch_order_line(models.TransientModel):
supplier_ids = fields.Many2many(comodel_name='res.partner', string='Vendor', domain=lambda self: [("id", "in", self.env['lunch.product'].search([]).mapped("supplier").ids)])
is_max_budget = fields.Boolean("I'm not feeling rich", help="Enable this option to set a maximal budget for your lucky order.", store=True)
max_budget = fields.Float('Max Budget', store=True)
@api.multi
def random_pick(self):
"""
@@ -24,13 +26,13 @@ class lunch_order_line(models.TransientModel):
"""
self.ensure_one()
if self.is_max_budget:
products_obj = self.env['lunch.product'].search([('supplier', "in", self.supplier_ids.ids), ('price', '<=', self.max_budget)])
products_obj = self.env['lunch.product'].search([('supplier', "in", self.supplier_ids.ids), ('price', '<=', self.max_budget)])
else:
products_obj = self.env['lunch.product'].search([('supplier', "in", self.supplier_ids.ids)])
products_obj = self.env['lunch.product'].search([('supplier', "in", self.supplier_ids.ids)])
if len(products_obj) != 0:
random_product_obj = self.env['lunch.product'].browse([random.choice(products_obj.ids)])
order_line = self.env['lunch.order.line'].create({
'product_id': random_product_obj.id,
'product_id': random_product_obj.id,
'order_id': self._context['active_id']
})
else:
+8 -8
View File
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*
import base64
import openerp
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import SUPERUSER_ID
from openerp.http import request
from odoo import SUPERUSER_ID
from odoo.http import request, route
from odoo.addons.bus.controllers.main import BusController
class MailChatController(openerp.addons.bus.controllers.main.BusController):
class MailChatController(BusController):
def _default_request_uid(self):
""" For Anonymous people, they receive the access right of SUPERUSER_ID since they have NO access (auth=none)
@@ -33,7 +33,7 @@ class MailChatController(openerp.addons.bus.controllers.main.BusController):
# --------------------------
# Anonymous routes (Common Methods)
# --------------------------
@openerp.http.route('/mail/chat_post', type="json", auth="none")
@route('/mail/chat_post', type="json", auth="none")
def mail_chat_post(self, uuid, message_content, **kwargs):
request_uid = self._default_request_uid()
# find the author from the user session, which can be None
@@ -45,7 +45,7 @@ class MailChatController(openerp.addons.bus.controllers.main.BusController):
message = mail_channel.sudo(request_uid).with_context(mail_create_nosubscribe=True).message_post(author_id=author_id, email_from=False, body=message_content, message_type='comment', subtype='mail.mt_comment', content_subtype='plaintext', **kwargs)
return message and message.id or False
@openerp.http.route(['/mail/chat_history'], type="json", auth="none")
@route(['/mail/chat_history'], type="json", auth="none")
def mail_chat_history(self, uuid, last_id=False, limit=20):
request_uid = self._default_request_uid()
channel = request.env["mail.channel"].sudo(request_uid).search([('uuid', '=', uuid)], limit=1)
+13 -12
View File
@@ -1,17 +1,18 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import json
from operator import itemgetter
import psycopg2
import werkzeug
from operator import itemgetter
from werkzeug import url_encode
import openerp
from openerp import SUPERUSER_ID
from openerp import http
from openerp.exceptions import AccessError
from openerp.http import request
from openerp.addons.web.controllers.main import binary_content
from odoo import http, registry, SUPERUSER_ID
from odoo.addons.web.controllers.main import binary_content
from odoo.exceptions import AccessError
from odoo.http import request
class MailController(http.Controller):
@@ -29,9 +30,9 @@ class MailController(http.Controller):
for db in dbs:
message = dbs[db].decode('base64')
try:
registry = openerp.registry(db)
with registry.cursor() as cr:
mail_thread = registry['mail.thread']
db_registry = registry(db)
with db_registry.cursor() as cr:
mail_thread = db_registry['mail.thread']
mail_thread.message_process(cr, SUPERUSER_ID, None, message)
except psycopg2.Error:
pass
@@ -222,7 +223,7 @@ class MailController(http.Controller):
# if the current user has access to the document, get the partner avatar as sudo()
request.env[res_model].browse(res_id).check_access_rule('read')
if partner_id in request.env[res_model].browse(res_id).sudo().exists().message_ids.mapped('author_id').ids:
status, headers, _content = binary_content(model='res.partner', id=partner_id, field='image_medium', default_mimetype='image/png', env=request.env(user=openerp.SUPERUSER_ID))
status, headers, _content = binary_content(model='res.partner', id=partner_id, field='image_medium', default_mimetype='image/png', env=request.env(user=SUPERUSER_ID))
# binary content return an empty string and not a placeholder if obj[field] is False
if _content != '':
content = _content
+3 -2
View File
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import _, api, fields, models
from openerp.exceptions import UserError
from odoo import _, api, fields, models
from odoo.exceptions import UserError
class ServerActions(models.Model):
+2 -1
View File
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models
from odoo import models
class AutoVacuum(models.AbstractModel):
_inherit = 'ir.autovacuum'
+5 -5
View File
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import re
import unicodedata
from openerp import _, api, fields, models, SUPERUSER_ID
from openerp.exceptions import ValidationError
from openerp.modules.registry import RegistryManager
from openerp.tools import ustr
from openerp.tools.safe_eval import safe_eval as eval
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.tools import ustr
from odoo.tools.safe_eval import safe_eval as eval
_logger = logging.getLogger(__name__)
+6 -6
View File
@@ -1,16 +1,16 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from email.utils import formataddr
import re
import uuid
from openerp import _, api, fields, models, modules, tools
from openerp.exceptions import UserError
from openerp.osv import expression
from openerp.tools import ormcache
from openerp.tools.safe_eval import safe_eval as eval
from odoo import _, api, fields, models, modules, tools
from odoo.exceptions import UserError
from odoo.osv import expression
from odoo.tools import ormcache
from odoo.tools.safe_eval import safe_eval as eval
class ChannelPartner(models.Model):
+2 -1
View File
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
from odoo import api, fields, models
class Followers(models.Model):
+6 -6
View File
@@ -1,18 +1,18 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import datetime
import logging
import psycopg2
import threading
from email.utils import formataddr
import psycopg2
from openerp import _, api, fields, models
from openerp import tools
from openerp.addons.base.ir.ir_mail_server import MailDeliveryException
from openerp.tools.safe_eval import safe_eval as eval
from odoo import _, api, fields, models
from odoo import tools
from odoo.addons.base.ir.ir_mail_server import MailDeliveryException
from odoo.tools.safe_eval import safe_eval as eval
_logger = logging.getLogger(__name__)
+6 -5
View File
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from email.header import decode_header
from email.utils import formataddr
import logging
from openerp import _, api, fields, models, SUPERUSER_ID
from openerp import tools
from openerp.exceptions import UserError, AccessError
from openerp.osv import expression
from odoo import _, api, fields, models, SUPERUSER_ID, tools
from odoo.exceptions import UserError, AccessError
from odoo.osv import expression
_logger = logging.getLogger(__name__)

Some files were not shown because too many files have changed in this diff Show More