[MERGE] forward port of branch saas-3 up to revid 9328 chs@openerp.com-20140318120024-mcxmkncn1xktjs7v

bzr revid: chs@openerp.com-20140318132741-aur3q1k7t9iympri
This commit is contained in:
Christophe Simonis 2014-03-18 14:27:41 +01:00
commit 99a3c45976
41 changed files with 354 additions and 144 deletions

View File

@ -30,7 +30,7 @@ from openerp import SUPERUSER_ID
from openerp import tools
from openerp.osv import fields, osv, expression
from openerp.tools.translate import _
from openerp.tools.float_utils import float_round
from openerp.tools.float_utils import float_round as round
import openerp.addons.decimal_precision as dp
@ -1937,15 +1937,15 @@ class account_tax(osv.osv):
#
'base_code_id': fields.many2one('account.tax.code', 'Account Base Code', help="Use this code for the tax declaration."),
'tax_code_id': fields.many2one('account.tax.code', 'Account Tax Code', help="Use this code for the tax declaration."),
'base_sign': fields.float('Base Code Sign', help="Usually 1 or -1."),
'tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."),
'base_sign': fields.float('Base Code Sign', help="Usually 1 or -1.", digits_compute=get_precision_tax()),
'tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1.", digits_compute=get_precision_tax()),
# Same fields for refund invoices
'ref_base_code_id': fields.many2one('account.tax.code', 'Refund Base Code', help="Use this code for the tax declaration."),
'ref_tax_code_id': fields.many2one('account.tax.code', 'Refund Tax Code', help="Use this code for the tax declaration."),
'ref_base_sign': fields.float('Refund Base Code Sign', help="Usually 1 or -1."),
'ref_tax_sign': fields.float('Refund Tax Code Sign', help="Usually 1 or -1."),
'ref_base_sign': fields.float('Refund Base Code Sign', help="Usually 1 or -1.", digits_compute=get_precision_tax()),
'ref_tax_sign': fields.float('Refund Tax Code Sign', help="Usually 1 or -1.", digits_compute=get_precision_tax()),
'include_base_amount': fields.boolean('Included in base amount', help="Indicates if the amount of tax must be included in the base amount for the computation of the next taxes"),
'company_id': fields.many2one('res.company', 'Company', required=True),
'description': fields.char('Tax Code'),
@ -2143,7 +2143,7 @@ class account_tax(osv.osv):
tax_compute_precision = precision
if taxes and taxes[0].company_id.tax_calculation_rounding_method == 'round_globally':
tax_compute_precision += 5
totalin = totalex = float_round(price_unit * quantity, precision)
totalin = totalex = round(price_unit * quantity, precision)
tin = []
tex = []
for tax in taxes:

View File

@ -41,6 +41,23 @@ class account_voucher(osv.osv):
'number': fields.char('Number', size=32),
}
def _amount_to_text(self, cr, uid, amount, currency_id, context=None):
# Currency complete name is not available in res.currency model
# Exceptions done here (EUR, USD, BRL) cover 75% of cases
# For other currencies, display the currency code
currency = self.pool['res.currency'].browse(cr, uid, currency_id, context=context)
if currency.name.upper() == 'EUR':
currency_name = 'Euro'
elif currency.name.upper() == 'USD':
currency_name = 'Dollars'
elif currency.name.upper() == 'BRL':
currency_name = 'reais'
else:
currency_name = currency.name
#TODO : generic amount_to_text is not ready yet, otherwise language (and country) and currency can be passed
#amount_in_word = amount_to_text(amount, context=context)
return amount_to_text(amount, currency=currency_name)
def onchange_amount(self, cr, uid, ids, amount, rate, partner_id, journal_id, currency_id, ttype, date, payment_rate_currency_id, company_id, context=None):
""" Inherited - add amount_in_word and allow_check_writting in returned value dictionary """
if not context:
@ -48,22 +65,7 @@ class account_voucher(osv.osv):
default = super(account_voucher, self).onchange_amount(cr, uid, ids, amount, rate, partner_id, journal_id, currency_id, ttype, date, payment_rate_currency_id, company_id, context=context)
if 'value' in default:
amount = 'amount' in default['value'] and default['value']['amount'] or amount
# Currency complete name is not available in res.currency model
# Exceptions done here (EUR, USD, BRL) cover 75% of cases
# For other currencies, display the currency code
currency = self.pool['res.currency'].browse(cr, uid, currency_id, context=context)
if currency.name.upper() == 'EUR':
currency_name = 'Euro'
elif currency.name.upper() == 'USD':
currency_name = 'Dollars'
elif currency.name.upper() == 'BRL':
currency_name = 'reais'
else:
currency_name = currency.name
#TODO : generic amount_to_text is not ready yet, otherwise language (and country) and currency can be passed
#amount_in_word = amount_to_text(amount, context=context)
amount_in_word = amount_to_text(amount, currency=currency_name)
amount_in_word = self._amount_to_text(cr, uid, amount, currency_id, context=context)
default['value'].update({'amount_in_word':amount_in_word})
if journal_id:
allow_check_writing = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context).allow_check_writing
@ -92,6 +94,19 @@ class account_voucher(osv.osv):
},
'nodestroy': True
}
def create(self, cr, uid, vals, context=None):
if vals.get('amount') and vals.get('journal_id') and 'amount_in_word' not in vals:
vals['amount_in_word'] = self._amount_to_text(cr, uid, vals['amount'], vals.get('currency_id') or \
self.pool['account.journal'].browse(cr, uid, vals['journal_id'], context=context).currency.id or \
self.pool['res.company'].browse(cr, uid, vals['company_id']).currency_id.id, context=context)
return super(account_voucher, self).create(cr, uid, vals, context=context)
def write(self, cr, uid, ids, vals, context=None):
if vals.get('amount') and vals.get('journal_id') and 'amount_in_word' not in vals:
vals['amount_in_word'] = self._amount_to_text(cr, uid, vals['amount'], vals.get('currency_id') or \
self.pool['account.journal'].browse(cr, uid, vals['journal_id'], context=context).currency.id or \
self.pool['res.company'].browse(cr, uid, vals['company_id']).currency_id.id, context=context)
return super(account_voucher, self).write(cr, uid, ids, vals, context=context)
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
"""

View File

@ -463,14 +463,12 @@ def process_data(cr, uid, pool, res_ids, model, method, old_values=None, new_val
# if at least one modification has been found
for model_id, resource_id in lines:
line_model = pool.get('ir.model').browse(cr, SUPERUSER_ID, model_id).model
name = pool.get(line_model).name_get(cr, uid, [resource_id])[0][1]
vals = {
'method': method,
'object_id': model_id,
'user_id': uid,
'res_id': resource_id,
'name': name,
}
if (model_id, resource_id) not in old_values and method not in ('copy', 'read'):
# the resource was not existing so we are forcing the method to 'create'
@ -481,7 +479,11 @@ def process_data(cr, uid, pool, res_ids, model, method, old_values=None, new_val
# the resource is not existing anymore so we are forcing the method to 'unlink'
# (because it could also come with the value 'write' if we are deleting the
# record through a one2many field)
name = old_values[(model_id, resource_id)]['value'].get('name',False)
vals.update({'method': 'unlink'})
else :
name = pool[line_model].name_get(cr, uid, [resource_id])[0][1]
vals.update({'name': name})
# create the audittrail log in super admin mode, only if a change has been detected
if lines[(model_id, resource_id)]:
log_id = pool.get('audittrail.log').create(cr, SUPERUSER_ID, vals)

View File

@ -456,7 +456,7 @@ class calendar_alarm_manager(osv.AbstractModel):
bFound = False
LastFound = False
for one_date in self.pool.get('calendar.event').get_recurrent_date_by_event(cr, uid, curEvent, context=context):
in_date_format = datetime.strptime(one_date, '%Y-%m-%d %H:%M:%S')
in_date_format = one_date.replace(tzinfo=None)
LastFound = self.do_check_alarm_for_one_date(cr, uid, in_date_format, curEvent, max_delta, cron_interval, notif=False, context=context)
if LastFound:
for alert in LastFound:
@ -490,7 +490,7 @@ class calendar_alarm_manager(osv.AbstractModel):
bFound = False
LastFound = False
for one_date in self.pool.get("calendar.event").get_recurrent_date_by_event(cr, uid, curEvent, context=context):
in_date_format = datetime.strptime(one_date, '%Y-%m-%d %H:%M:%S')
in_date_format = one_date.replace(tzinfo=None)
LastFound = self.do_check_alarm_for_one_date(cr, uid, in_date_format, curEvent, max_delta, ajax_check_every_seconds, after=partner.calendar_last_notif_ack, mail=False, context=context)
if LastFound:
for alert in LastFound:
@ -680,19 +680,23 @@ class calendar_event(osv.Model):
return [d.astimezone(pytz.UTC) for d in rset1]
def _get_recurrency_end_date(self, data, context=None):
if data.get('recurrency') and data.get('end_type') in ('count', unicode('count')):
data_date_deadline = datetime.strptime(data.get('date_deadline'), '%Y-%m-%d %H:%M:%S')
if data.get('rrule_type') in ('daily', unicode('count')):
rel_date = relativedelta(days=data.get('count') + 1)
elif data.get('rrule_type') in ('weekly', unicode('weekly')):
rel_date = relativedelta(days=(data.get('count') + 1) * 7)
elif data.get('rrule_type') in ('monthly', unicode('monthly')):
rel_date = relativedelta(months=data.get('count') + 1)
elif data.get('rrule_type') in ('yearly', unicode('yearly')):
rel_date = relativedelta(years=data.get('count') + 1)
end_date = data_date_deadline + rel_date
else:
end_date = data.get('end_date')
if not data.get('recurrency'):
return False
end_type = data.get('end_type')
end_date = data.get('end_date')
if end_type == 'count' and all(data.get(key) for key in ['count', 'rrule_type', 'date_deadline']):
count = data['count'] + 1
delay, mult = {
'daily': ('days', 1),
'weekly': ('days', 7),
'monthly': ('months', 1),
'yearly': ('years', 1),
}[data['rrule_type']]
deadline = datetime.strptime(data['date_deadline'], tools.DEFAULT_SERVER_DATETIME_FORMAT)
return deadline + relativedelta(**{delay: count * mult})
return end_date
def _find_my_attendee(self, cr, uid, meeting_ids, context=None):
@ -774,7 +778,11 @@ class calendar_event(osv.Model):
result[event] = ""
return result
# retro compatibility function
def _rrule_write(self, cr, uid, ids, field_name, field_value, args, context=None):
return self._set_rulestring(self, cr, uid, ids, field_name, field_value, args, context=context)
def _set_rulestring(self, cr, uid, ids, field_name, field_value, args, context=None):
if not isinstance(ids, list):
ids = [ids]
data = self._get_empty_rrule_data()
@ -812,7 +820,7 @@ class calendar_event(osv.Model):
'class': fields.selection([('public', 'Public'), ('private', 'Private'), ('confidential', 'Public for Employees')], 'Privacy', states={'done': [('readonly', True)]}),
'location': fields.char('Location', help="Location of Event", track_visibility='onchange', states={'done': [('readonly', True)]}),
'show_as': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Show Time as', states={'done': [('readonly', True)]}),
'rrule': fields.function(_get_rulestring, type='char', fnct_inv=_rrule_write, store=True, string='Recurrent Rule'),
'rrule': fields.function(_get_rulestring, type='char', fnct_inv=_set_rulestring, store=True, string='Recurrent Rule'),
'rrule_type': fields.selection([('daily', 'Day(s)'), ('weekly', 'Week(s)'), ('monthly', 'Month(s)'), ('yearly', 'Year(s)')], 'Recurrency', states={'done': [('readonly', True)]}, help="Let the event automatically repeat at that interval"),
'recurrency': fields.boolean('Recurrent', help="Recurrent Meeting"),
'recurrent_id': fields.integer('Recurrent ID'),
@ -1169,7 +1177,7 @@ class calendar_event(osv.Model):
#repeat monthly by nweekday ((weekday, weeknumber), )
if r._bynweekday:
data['week_list'] = day_list[r._bynweekday[0][0]].upper()
data['byday'] = r._bynweekday[0][1]
data['byday'] = str(r._bynweekday[0][1])
data['month_by'] = 'day'
data['rrule_type'] = 'monthly'
@ -1423,7 +1431,7 @@ class calendar_event(osv.Model):
# set end_date for calendar searching
if values.get('recurrency', True) and values.get('end_type', 'count') in ('count', unicode('count')) and \
(values.get('rrule_type') or values.get('count') or values.get('date') or values.get('date_deadline')):
for data in self.read(cr, uid, ids, ['date', 'date_deadline', 'recurrency', 'rrule_type', 'count', 'end_type'], context=context):
for data in self.read(cr, uid, ids, ['end_date', 'date_deadline', 'recurrency', 'rrule_type', 'count', 'end_type'], context=context):
end_date = self._get_recurrency_end_date(data, context=context)
super(calendar_event, self).write(cr, uid, [data['id']], {'end_date': end_date}, context=context)
@ -1454,11 +1462,12 @@ class calendar_event(osv.Model):
if not 'user_id' in vals: # Else bug with quick_create when we are filter on an other user
vals['user_id'] = uid
if vals.get('recurrency', True) and vals.get('end_type', 'count') in ('count', unicode('count')) and \
(vals.get('rrule_type') or vals.get('count') or vals.get('date') or vals.get('date_deadline')):
vals['end_date'] = self._get_recurrency_end_date(vals, context=context)
res = super(calendar_event, self).create(cr, uid, vals, context=context)
data = self.read(cr, uid, [res], ['end_date', 'date_deadline', 'recurrency', 'rrule_type', 'count', 'end_type'], context=context)[0]
end_date = self._get_recurrency_end_date(data, context=context)
self.write(cr, uid, [res], {'end_date': end_date}, context=context)
self.create_attendees(cr, uid, [res], context=context)
return res

View File

@ -65,3 +65,20 @@
-
!python {model: calendar.event}: |
self.write(cr, uid, [ref("calendar_event_alldaytestevent0")], {'alarm_ids': [(6,0,[ref("res_alarm_daybeforeeventstarts0")])]})
-
I create a recuring rule for my event
-
!record {model: calendar.event, id: calendar.event_sprintreview1}:
name: Begin of month meeting
date: !eval time.strftime('%Y-%m-%d 12:00:00')
recurrency: true
rrule: FREQ=MONTHLY;INTERVAL=1;COUNT=12;BYDAY=1MO
-
I check that the attributes are set correctly
-
!assert {model: calendar.event, id: calendar.event_sprintreview1}:
- rrule_type == 'monthly'
- count == 12
- month_by == 'day'
- byday == '1'
- week_list == 'MO'

View File

@ -313,7 +313,10 @@ class crm_lead(format_address, osv.osv):
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context=context)
if not stage.on_change:
return {'value': {}}
return {'value': {'probability': stage.probability}}
vals = {'probability': stage.probability}
if stage.probability >= 100 or (stage.probability == 0 and stage.sequence > 1):
vals['date_closed'] = fields.datetime.now()
return {'value': vals}
def on_change_partner_id(self, cr, uid, ids, partner_id, context=None):
values = {}
@ -407,7 +410,7 @@ class crm_lead(format_address, osv.osv):
'probability = 0 %, select "Change Probability Automatically".\n'
'Create a specific stage or edit an existing one by editing columns of your opportunity pipe.'))
for stage_id, lead_ids in stages_leads.items():
self.write(cr, uid, lead_ids, {'stage_id': stage_id, 'date_closed': fields.datetime.now()}, context=context)
self.write(cr, uid, lead_ids, {'stage_id': stage_id}, context=context)
return True
def case_mark_won(self, cr, uid, ids, context=None):
@ -428,7 +431,7 @@ class crm_lead(format_address, osv.osv):
'probability = 100 % and select "Change Probability Automatically".\n'
'Create a specific stage or edit an existing one by editing columns of your opportunity pipe.'))
for stage_id, lead_ids in stages_leads.items():
self.write(cr, uid, lead_ids, {'stage_id': stage_id, 'date_closed': fields.datetime.now()}, context=context)
self.write(cr, uid, lead_ids, {'stage_id': stage_id}, context=context)
return True
def case_escalate(self, cr, uid, ids, context=None):

View File

@ -95,7 +95,6 @@
<form string="Leads Form" version="7.0">
<header>
<button name="%(crm.action_crm_lead2opportunity_partner)d" string="Convert to Opportunity" type="action"
attrs="{'invisible': [('probability', '=', 100)]}"
help="Convert to Opportunity" class="oe_highlight"/>
<field name="stage_id" widget="statusbar" clickable="True"
domain="['&amp;', '|', ('case_default', '=', True), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"

View File

@ -21,6 +21,7 @@
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools import email_split
import re
class crm_lead2opportunity_partner(osv.osv_memory):
@ -42,20 +43,21 @@ class crm_lead2opportunity_partner(osv.osv_memory):
return {'value': {'partner_id': False if action != 'exist' else self._find_matching_partner(cr, uid, context=context)}}
def _get_duplicated_leads(self, cr, uid, partner_id, email, context=None):
"""
Search for opportunities that have the same partner and that arent done or cancelled
"""
lead_obj = self.pool.get('crm.lead')
results = []
emails = set(email_split(email) + [email])
final_stage_domain = [('stage_id.probability', '<', 100), '|', ('stage_id.probability', '>', 0), ('stage_id.sequence', '<=', 1)]
partner_match_domain = []
for email in emails:
partner_match_domain.append(('email_from', '=ilike', email))
if partner_id:
# Search for opportunities that have the same partner and that arent done or cancelled
ids = lead_obj.search(cr, uid, [('partner_id', '=', partner_id), '|', ('stage_id.probability', '=', False), ('stage_id.probability', '<', '100')])
for id in ids:
results.append(id)
email = re.findall(r'([^ ,<@]+@[^> ,]+)', email or '')
if email:
ids = lead_obj.search(cr, uid, [('email_from', '=ilike', email[0]), '|', ('stage_id.probability', '=', False), ('stage_id.probability', '<', '100')])
for id in ids:
results.append(id)
return list(set(results))
partner_match_domain.append(('partner_id', '=', partner_id))
partner_match_domain = ['|'] * (len(partner_match_domain) - 1) + partner_match_domain
if not partner_match_domain:
return []
return lead_obj.search(cr, uid, partner_match_domain + final_stage_domain)
def default_get(self, cr, uid, fields, context=None):
"""
@ -126,7 +128,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
leads = lead.browse(cr, uid, lead_ids, context=context)
for lead_id in leads:
partner_id = self._create_partner(cr, uid, lead_id.id, data.action, lead_id.partner_id.id, context=context)
res = lead.convert_opportunity(cr, uid, [lead_id.id], partner_id, [], team_id, context=context)
res = lead.convert_opportunity(cr, uid, [lead_id.id], partner_id, [], False, context=context)
user_ids = vals.get('user_ids', False)
if context.get('no_force_assignation'):
leads_to_allocate = [lead_id.id for lead_id in leads if not lead_id.user_id]

View File

@ -15,10 +15,10 @@
<div class="oe_title">
<h3>
<span class="oe_grey">( </span>
<field name="partner_latitude" nolabel="1" readonly="1" class="oe_inline"/>
<field name="partner_latitude" nolabel="1" class="oe_inline"/>
<span class="oe_grey oe_inline" attrs="{'invisible':[('partner_latitude','&lt;=',0)]}">N </span>
<span class="oe_grey oe_inline" attrs="{'invisible':[('partner_latitude','&gt;=',0)]}">S </span>
<field name="partner_longitude" class="oe_inline" readonly="1" nolabel="1"/>
<field name="partner_longitude" class="oe_inline" nolabel="1"/>
<span class="oe_grey oe_inline" attrs="{'invisible':[('partner_longitude','&lt;=',0)]}">E </span>
<span class="oe_grey oe_inline" attrs="{'invisible':[('partner_longitude','&gt;=',0)]}">W </span>
<span class="oe_grey">) </span>
@ -88,10 +88,10 @@
<div>
<h3>
<span class="oe_grey">( </span>
<field name="partner_latitude" nolabel="1" readonly="1" class="oe_inline"/>
<field name="partner_latitude" nolabel="1" class="oe_inline"/>
<span class="oe_grey oe_inline" attrs="{'invisible':[('partner_latitude','&lt;=',0)]}">N </span>
<span class="oe_grey oe_inline" attrs="{'invisible':[('partner_latitude','&gt;=',0)]}">S </span>
<field name="partner_longitude" class="oe_inline" readonly="1" nolabel="1"/>
<field name="partner_longitude" class="oe_inline" nolabel="1"/>
<span class="oe_grey oe_inline" attrs="{'invisible':[('partner_longitude','&lt;=',0)]}">E </span>
<span class="oe_grey oe_inline" attrs="{'invisible':[('partner_longitude','&gt;=',0)]}">W </span>
<span class="oe_grey">) </span>

View File

@ -161,6 +161,7 @@ class mail_thread(osv.AbstractModel):
if res[id]['message_unread_count']:
title = res[id]['message_unread_count'] > 1 and _("You have %d unread messages") % res[id]['message_unread_count'] or _("You have one unread message")
res[id]['message_summary'] = "<span class='oe_kanban_mail_new' title='%s'><span class='oe_e'>9</span> %d %s</span>" % (title, res[id].pop('message_unread_count'), _("New"))
res[id].pop('message_unread_count', None)
return res
def read_followers_data(self, cr, uid, follower_ids, context=None):

View File

@ -14,6 +14,10 @@ _logger = logging.getLogger(__name__)
class pad_common(osv.osv_memory):
_name = 'pad.common'
def pad_is_configured(self, cr, uid, context=None):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return bool(user.company_id.pad_server)
def pad_generate_url(self, cr, uid, context=None):
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id;

View File

@ -70,6 +70,7 @@
.oe_pad_loading{
text-align: center;
opacity: 0.75;
font-style: italic;
}
.etherpad_readonly ul, .etherpad_readonly ol {

View File

@ -1,66 +1,82 @@
openerp.pad = function(instance) {
var _t = instance.web._t;
instance.web.form.FieldPad = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeWidgetMixin, {
template: 'FieldPad',
content: "",
init: function() {
var self = this;
this._super.apply(this, arguments);
this.set("configured", true);
this.on("change:configured", this, this.switch_configured);
this._configured_deferred = this.view.dataset.call('pad_is_configured').done(function(data) {
self.set("configured", !!data);
}).fail(function(data, event) {
event.preventDefault();
self.set("configured", true);
});
},
initialize_content: function() {
var self = this;
this.switch_configured();
this.$('.oe_pad_switch').click(function() {
self.$el.toggleClass('oe_pad_fullscreen');
self.$el.find('.oe_pad_switch').toggleClass('fa-expand fa-compress');
self.view.$el.find('.oe_chatter').toggle();
});
this._configured_deferred.always(function() {
var configured = self.get('configured');
self.$(".oe_unconfigured").toggle(!configured);
self.$(".oe_configured").toggle(configured);
});
this.render_value();
},
switch_configured: function() {
this.$(".oe_unconfigured").toggle(! this.get("configured"));
this.$(".oe_configured").toggle(this.get("configured"));
},
render_value: function() {
var self = this;
if (this.get("configured") && ! this.get("value")) {
self.view.dataset.call('pad_generate_url', {
context: {
model: self.view.model,
field_name: self.name,
object_id: self.view.datarecord.id
},
}).done(function(data) {
if (! data.url) {
self.set("configured", false);
var self = this;
this._configured_deferred.always(function() {
if (! self.get('configured')) {
return;
};
var value = self.get('value');
if (self.get('effective_readonly')) {
if (_.str.startsWith(value, 'http')) {
this.pad_loading_request = self.view.dataset.call('pad_get_content', {url: value}).done(function(data) {
self.$('.oe_pad_content').removeClass('oe_pad_loading').html('<div class="oe_pad_readonly"><div>');
self.$('.oe_pad_readonly').html(data);
}).fail(function() {
self.$('.oe_pad_content').text(_t('Unable to load pad'));
});
} else {
self.set("value", data.url);
self.$('.oe_pad_content').addClass('oe_pad_loading').show().text(_t("This pad will be initialized on first edit"));
}
});
}
this.$('.oe_pad_content').html("");
var value = this.get('value');
if (this.pad_loading_request) {
this.pad_loading_request.abort();
}
if (_.str.startsWith(value, 'http')) {
if (! this.get('effective_readonly')) {
var content = '<iframe width="100%" height="100%" frameborder="0" src="' + value + '?showChat=false&userName=' + this.session.username + '"></iframe>';
this.$('.oe_pad_content').html(content);
this._dirty_flag = true;
} else {
this.content = '<div class="oe_pad_loading">... Loading pad ...</div>';
this.pad_loading_request = $.get(value + '/export/html').done(function(data) {
groups = /\<\s*body\s*\>(.*?)\<\s*\/body\s*\>/.exec(data);
data = (groups || []).length >= 2 ? groups[1] : '';
self.$('.oe_pad_content').html('<div class="oe_pad_readonly"><div>');
self.$('.oe_pad_readonly').html(data);
}).fail(function() {
self.$('.oe_pad_content').text('Unable to load pad');
}
else {
var def = $.when();
if (! value || !_.str.startsWith(value, 'http')) {
def = self.view.dataset.call('pad_generate_url', {
context: {
model: self.view.model,
field_name: self.name,
object_id: self.view.datarecord.id
},
}).done(function(data) {
if (! data.url) {
self.set("configured", false);
} else {
self.set("value", data.url);
}
});
}
def.then(function() {
value = self.get('value');
if (_.str.startsWith(value, 'http')) {
var content = '<iframe width="100%" height="100%" frameborder="0" src="' + value + '?showChat=false&userName=' + self.session.username + '"></iframe>';
self.$('.oe_pad_content').html(content);
self._dirty_flag = true;
}
else {
self.$('.oe_pad_content').text(value);
}
});
}
}
});
},
});

View File

@ -513,7 +513,7 @@ class pos_order(osv.osv):
_description = "Point of Sale"
_order = "id desc"
def create_from_ui(self, cr, uid, orders, context=None):
def create_from_ui(self, cr, uid, orders, context=None):
# Keep only new orders
submitted_references = [o['data']['name'] for o in orders]

View File

@ -35,14 +35,14 @@ class mail_message(osv.Model):
"""
if uid == SUPERUSER_ID:
return super(mail_message, self)._search(cr, uid, args, offset=offset, limit=limit, order=order,
context=context, count=False, access_rights_uid=access_rights_uid)
context=context, count=count, access_rights_uid=access_rights_uid)
group_ids = self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id
group_user_id = self.pool.get("ir.model.data").get_object_reference(cr, uid, 'base', 'group_user')[1]
if group_user_id not in [group.id for group in group_ids]:
args = [('subtype_id', '!=', False)] + list(args)
return super(mail_message, self)._search(cr, uid, args, offset=offset, limit=limit, order=order,
context=context, count=False, access_rights_uid=access_rights_uid)
context=context, count=count, access_rights_uid=access_rights_uid)
def check_access_rule(self, cr, uid, ids, operation, context=None):
""" Add Access rules of mail.message for non-employee user:

View File

@ -115,11 +115,29 @@ class product_pricelist(osv.osv):
if name and operator == '=' and not args:
# search on the name of the pricelist and its currency, opposite of name_get(),
# Used by the magic context filter in the product search view.
query_args = {'name': name, 'limit': limit}
query_args = {'name': name, 'limit': limit, 'lang': (context or {}).get('lang') or 'en_US'}
query = """SELECT p.id
FROM product_pricelist p JOIN
res_currency c ON (p.currency_id = c.id)
WHERE p.name || ' (' || c.name || ')' = %(name)s
FROM ((
SELECT pr.id, pr.name
FROM product_pricelist pr JOIN
res_currency cur ON
(pr.currency_id = cur.id)
WHERE pr.name || ' (' || cur.name || ')' = %(name)s
)
UNION (
SELECT tr.res_id as id, tr.value as name
FROM ir_translation tr JOIN
product_pricelist pr ON (
pr.id = tr.res_id AND
tr.type = 'model' AND
tr.name = 'product.pricelist,name' AND
tr.lang = %(lang)s
) JOIN
res_currency cur ON
(pr.currency_id = cur.id)
WHERE tr.value || ' (' || cur.name || ')' = %(name)s
)
) p
ORDER BY p.name"""
if limit:
query += " LIMIT %(limit)s"

View File

@ -527,12 +527,13 @@ class product_product(osv.osv):
cr, uid, pricelist, operator='=', context=context, limit=1)
pricelist = pricelist_ids[0][0] if pricelist_ids else pricelist
products = self.browse(cr, uid, ids, context=context)
qtys = map(lambda x: (x, quantity, partner), products)
pl = plobj.browse(cr, uid, pricelist, context=context)
price = plobj._price_get_multi(cr,uid, pl, qtys, context=context)
for id in ids:
res[id] = price.get(id, 0.0)
if isinstance(pricelist, (int, long)):
products = self.browse(cr, uid, ids, context=context)
qtys = map(lambda x: (x, quantity, partner), products)
pl = plobj.browse(cr, uid, pricelist, context=context)
price = plobj._price_get_multi(cr,uid, pl, qtys, context=context)
for id in ids:
res[id] = price.get(id, 0.0)
for id in ids:
res.setdefault(id, 0.0)
return res

View File

@ -906,7 +906,7 @@ class share_result_line(osv.osv_memory):
'login': fields.related('user_id', 'login', string='Login', type='char', size=64, required=True, readonly=True),
'password': fields.char('Password', size=64, readonly=True),
'share_url': fields.function(_share_url, string='Share URL', type='char', size=512),
'share_wizard_id': fields.many2one('share.wizard', 'Share Wizard', required=True),
'share_wizard_id': fields.many2one('share.wizard', 'Share Wizard', required=True, ondelete='cascade'),
'newly_created': fields.boolean('Newly created', readonly=True),
}
_defaults = {

View File

@ -2232,14 +2232,14 @@ class stock_move(osv.osv):
if move.picking_id:
pickings.add(move.picking_id.id)
if move.move_dest_id and move.move_dest_id.state == 'waiting':
self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'})
self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'}, context=context)
if context.get('call_unlink',False) and move.move_dest_id.picking_id:
workflow.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False})
self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False}, context=context)
if not context.get('call_unlink',False):
for pick in self.pool.get('stock.picking').browse(cr, uid, list(pickings), context=context):
if all(move.state == 'cancel' for move in pick.move_lines):
self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'})
self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'}, context=context)
for id in ids:
workflow.trg_trigger(uid, 'stock.move', id, cr)

View File

@ -792,7 +792,7 @@
</group>
<notebook>
<page string="Products">
<field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree', 'picking_type': 'internal'}" options='{"reload_on_button": true}'/>
<field name="move_lines" context="{'address_in_id': partner_id, 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'stock.view_move_picking_tree', 'picking_type': 'internal'}" options='{"reload_on_button": true}'/>
<field name="note" placeholder="Add an internal note..." class="oe_inline"/>
</page>
<page string="Additional Info">
@ -926,7 +926,7 @@
<field name="partner_id" on_change="onchange_partner_in(partner_id)" string="Customer" domain="[('customer','=',True)]" />
</xpath>
<xpath expr="//field[@name='move_lines']" position="replace">
<field name="move_lines" context="{'address_out_id': partner_id, 'picking_type': 'out', 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}" options='{"reload_on_button": true}'/>
<field name="move_lines" context="{'address_out_id': partner_id, 'picking_type': 'out', 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'stock.view_move_picking_tree'}" options='{"reload_on_button": true}'/>
</xpath>
<xpath expr="/form/sheet" position="after">
<div class="oe_chatter">
@ -1053,7 +1053,7 @@
<field name="partner_id" on_change="onchange_partner_in(partner_id)" string="Supplier" domain="[('supplier','=',True)]" context="{'default_supplier':1,'default_customer':0}"/>
</xpath>
<xpath expr="//field[@name='move_lines']" position="replace">
<field name="move_lines" context="{'address_in_id': partner_id, 'picking_type': 'in', 'form_view_ref':'view_move_picking_form', 'tree_view_ref':'view_move_picking_tree'}" options='{"reload_on_button": true}'/>
<field name="move_lines" context="{'address_in_id': partner_id, 'picking_type': 'in', 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'stock.view_move_picking_tree'}" options='{"reload_on_button": true}'/>
</xpath>
<xpath expr="/form/sheet" position="after">
<div class="oe_chatter">

View File

@ -0,0 +1,27 @@
#website-top-navbar a.btn-link {
color: #ad1d28;
}
.oe_product section {
background: rgba(16, 138, 147, 0.75) !important;
}
.oe_product section .text-info {
color: #DFD6F5;
}
ul.wizard li {
background: #debb27 !important;
}
ul.wizard .chevron:before {
border-left: 10px solid #debb27 !important;
}
ul.wizard .text-primary {
color: #ad1d28 !important;
}
ul.wizard .text-success {
color: #ffffff !important;
}
.oe_structure.oe_empty:empty:before, [data-oe-type=html]:empty:before {
color: #79D5DB !important;
}
.input-group-addon .fa {
color: #444;
}

View File

@ -0,0 +1,7 @@
#website-top-navbar button.btn-primary {
color: #fff;
border: 2px solid #0061c2;
}
#website-top-navbar a.btn-link {
color: #fff;
}

View File

@ -0,0 +1,30 @@
.oe_product section {
background: rgba(40, 40, 40, 0.85) !important;
}
.oe_product section .text-info {
color: #BA66E4;
}
ul.wizard li {
background: #222 !important;
}
ul.wizard .chevron:before {
border-left: 10px solid #222 !important;
}
.popover, .modal-content {
border: 1px solid rgba(200,200,200,0.5);
}
.close {
color: #fff;
}
.popover.bottom .arrow:after {
border-bottom-color: #333;
}
.popover.top .arrow:after {
border-top-color: #333;
}
.popover.left .arrow:after {
border-left-color: #333;
}
.popover.right .arrow:after {
border-right-color: #333;
}

View File

@ -0,0 +1,3 @@
#website-top-navbar a.btn-link {
color: #2c3e50;
}

View File

@ -0,0 +1,6 @@
#website-top-navbar button.btn-primary {
border: 2px solid #e4332e;
}
#website-top-navbar a.btn-link {
color: #fff;
}

View File

@ -0,0 +1,3 @@
.oe_product section .text-info {
color: #2A9CBE;
}

View File

@ -0,0 +1,3 @@
#website-top-navbar a.btn-link {
color: #fff;
}

View File

@ -0,0 +1,21 @@
.oe_product section {
background: rgba(40, 40, 45, 0.80) !important;
}
ul.wizard li {
background-image: -webkit-linear-gradient(#8a9196,#7a8288 60%,#788084) !important;
background-image: linear-gradient(#8a9196,#7a8288 60%,#788084 ) !important;
color: #ccc;
}
ul.wizard .chevron:before {
border-left: 10px solid #7C8386 !important;
}
ul.wizard li.text-primary {
color: #fff;
}
.close {
color: #fff;
}
.popover {
-webkit-box-shadow: 0px 0px 20px rgba(0,0,0,0.5);
box-shadow: 0px 0px 20px rgba(0,0,0,0.5);
}

View File

@ -0,0 +1,8 @@
.carousel .carousel-caption.content,
.carousel .carousel-caption.content h1,
.carousel .carousel-caption.content h2,
.carousel .carousel-caption.content h3,
.carousel .carousel-caption.content h4,
.carousel .carousel-caption.content h5 {
color: #ccc;
}

View File

@ -0,0 +1,6 @@
#website-top-navbar a.btn-link {
color: #fff;
}
.popover .close {
color: #fff;
}

View File

@ -240,7 +240,7 @@ ul.nav-stacked > li > a {
display: none;
}
[data-publish='off'] {
[data-publish='off'] > *:not(.css_options) {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
opacity: 0.5;
}

View File

@ -199,7 +199,7 @@ ul.nav-stacked > li > a
.btn-success, .css_unpublish
display: none
[data-publish='off']
[data-publish='off']>*:not(.css_options)
+opacity(0.5)
/* ---- END of PUBLISH ---- */

View File

@ -1003,7 +1003,7 @@
this.$target.find('.carousel-control').off('click').on('click', function () {
self.$target.carousel( $(this).data('slide')); });
this.$target.find('.carousel-inner .content > div').attr('contentEditable', 'true');
this.$target.find('.carousel-image, .carousel-inner .content > div').attr('contentEditable', 'true');
this.$target.find('.carousel-image').attr('attributeEditable', 'true');
this._super();
},

View File

@ -65,6 +65,7 @@
},
processTranslatableNodes: function () {
var self = this;
var source_attr = 'data-oe-source-id';
var $editables = $('[data-oe-model="ir.ui.view"]')
.not('link, script')
.not('.oe_snippets,.oe_snippet, .oe_snippet *')
@ -72,7 +73,8 @@
$editables.each(function () {
var $node = $(this);
var view_id = $node.attr('data-oe-source-id') || $node.attr('data-oe-id');
var source_id = $node.parents('[' + source_attr + ']:first').attr(source_attr)|0;
var view_id = $node.attr('data-oe-source-id') || source_id || $node.attr('data-oe-id');
self.transNode(this, view_id|0);
});
$('.oe_translatable_text').on('paste', function () {

View File

@ -6,7 +6,7 @@
<button type="button" data-action="save"
class="btn btn-primary">Save</button>
or
<a href="#" data-action="cancel">Discard</a>
<a href="#" data-action="cancel" class="btn btn-link">Discard</a>
</form>
<ul class="nav navbar-nav pull-right">
</ul>

View File

@ -206,6 +206,7 @@
<template id="website.theme_amelia" name="Amelia" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/amelia.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/amelia.fix.css' t-ignore="true"/>
</xpath>
</template>
@ -218,48 +219,56 @@
<template id="website.theme_cosmo" name="Cosmo" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/cosmo.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/cosmo.fix.css' t-ignore="true"/>
</xpath>
</template>
<template id="website.theme_cyborg" name="Cyborg" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/cyborg.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/cyborg.fix.css' t-ignore="true"/>
</xpath>
</template>
<template id="website.theme_flatly" name="Flatly" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/flatly.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/flatly.fix.css' t-ignore="true"/>
</xpath>
</template>
<template id="website.theme_journal" name="Journal" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/journal.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/journal.fix.css' t-ignore="true"/>
</xpath>
</template>
<template id="website.theme_readable" name="Readable" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/readable.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/readable.fix.css' t-ignore="true"/>
</xpath>
</template>
<template id="website.theme_simplex" name="Simplex" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/simplex.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/simplex.fix.css' t-ignore="true"/>
</xpath>
</template>
<template id="website.theme_slate" name="Slate" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/slate.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/slate.fix.css' t-ignore="true"/>
</xpath>
</template>
<template id="website.theme_spacelab" name="Spacelab" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/spacelab.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/spacelab.fix.css' t-ignore="true"/>
</xpath>
</template>
@ -272,6 +281,7 @@
<template id="website.theme_yeti" name="Yeti" inherit_option_id="website.theme">
<xpath expr="//link[@id='bootstrap_css']" position="replace">
<link rel='stylesheet' href='/website/static/src/css/bootswatch/yeti.min.css' t-ignore="true"/>
<link rel='stylesheet' href='/website/static/src/css/bootswatch/yeti.fix.css' t-ignore="true"/>
</xpath>
</template>

View File

@ -54,7 +54,7 @@ class MailMessage(osv.Model):
args = ['&', ('website_published', '=', True)] + list(args)
return super(MailMessage, self)._search(cr, uid, args, offset=offset, limit=limit, order=order,
context=context, count=False, access_rights_uid=access_rights_uid)
context=context, count=count, access_rights_uid=access_rights_uid)
def check_access_rule(self, cr, uid, ids, operation, context=None):
""" Add Access rules of mail.message for non-employee user:

View File

@ -603,7 +603,7 @@ class Ecommerce(http.Controller):
if tx:
acquirer_ids = [tx.acquirer_id.id]
else:
acquirer_ids = payment_obj.search(cr, SUPERUSER_ID, [('website_published', '=', True)], context=context)
acquirer_ids = payment_obj.search(cr, SUPERUSER_ID, [('website_published', '=', True), '|', ('company_id', '=', order.company_id.id), ('company_id', '=', False)], context=context)
values['acquirers'] = payment_obj.browse(cr, uid, acquirer_ids, context=context)
render_ctx = dict(context, submit_class='btn btn-primary', submit_txt='Pay Now')
for acquirer in values['acquirers']:

View File

@ -54,10 +54,9 @@
bottom: 0;
overflow: hidden;
padding: 0 15px 24px 0;
max-height: 110px;
min-height: 56px;
border-top: 1px solid rgba(255, 255, 255, 0.2);
background: rgba(100, 100, 100, 0.1);
background: rgba(255, 255, 255, 0.75);
z-index: 5;
}
.oe_product .product_price {
@ -72,9 +71,8 @@
}
.oe_product .oe_subdescription {
font-size: 0.8em;
max-height: 42px;
overflow: hidden;
margin-bottom: 30px;
margin-bottom: 10px;
}
.oe_mycart .input-group-addon {

View File

@ -48,10 +48,9 @@
bottom: 0
overflow: hidden
padding: 0 15px 24px 0
max-height: 110px
min-height: 56px
border-top: 1px solid rgba(255,255,255,0.2)
background: rgba(100, 100, 100, 0.1)
background: rgba(255, 255, 255, 0.75)
z-index: 5
.product_price
padding: 5px 0
@ -63,9 +62,8 @@
height: 100%
.oe_subdescription
font-size: 0.8em
max-height: 42px
overflow: hidden
margin-bottom: 30px
margin-bottom: 10px
.oe_mycart
.input-group-addon

View File

@ -193,7 +193,7 @@
</td>
</t>
<td t-if="not td_product"/>
<td t-if="not td_product" class="oe-height-2"/>
</t>
</tr>
</tbody>