[FIX]Fixes on, need fixing issues by MAT.

bzr revid: vme@tinyerp.com-20130523060223-hupizjpulghv8gsy
This commit is contained in:
Vidhin Mehta
2013-05-23 11:32:23 +05:30
parent c745a1d882
commit 2f15045af4
4 changed files with 60 additions and 58 deletions
+1 -1
View File
@@ -105,7 +105,7 @@
</header>
<sheet>
<div class="oe_right oe_button_box" name="buttons">
<button string="Schedule/Log Call"
<button string="Schedule/Log Call"
name="%(opportunity2phonecall_act)d"
type="action"/>
</div>
+15 -13
View File
@@ -27,6 +27,7 @@ from openerp import SUPERUSER_ID
from openerp.osv import osv, orm, fields
from openerp.tools import html_email_clean
from openerp.tools.translate import _
from HTMLParser import HTMLParser
_logger = logging.getLogger(__name__)
@@ -43,6 +44,19 @@ def decode(text):
text = decode_header(text.replace('\r', ''))
return ''.join([tools.ustr(x[0], x[1]) for x in text])
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)
def strip_tags(html):
s = MLStripper()
s.feed(html)
return s.get_data()
class mail_message(osv.Model):
""" Messages model: system notification (replacing res.log notifications),
@@ -121,19 +135,6 @@ class mail_message(osv.Model):
def name_get(self, cr, uid, ids, context=None):
# name_get may receive int id instead of an id list
from HTMLParser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)
def strip_tags(html):
s = MLStripper()
s.feed(html)
return s.get_data()
if isinstance(ids, (int, long)):
ids = [ids]
res = []
@@ -141,6 +142,7 @@ class mail_message(osv.Model):
name = '%s: %s' % (message.subject or '', strip_tags(message.body or '') or '')
res.append((message.id, self._shorten_name(name.lstrip(' :'))))
return res
_columns = {
'type': fields.selection([
('email', 'Email'),
-1
View File
@@ -926,7 +926,6 @@ class mail_thread(osv.AbstractModel):
author_ids = self._message_find_partners(cr, uid, message, ['From'], context=context)
if author_ids:
msg_dict['author_id'] = author_ids[0]
msg_dict['email_from'] = decode(message.get('from'))
partner_ids = self._message_find_partners(cr, uid, message, ['To', 'Cc'], context=context)
msg_dict['partner_ids'] = [(4, partner_id) for partner_id in partner_ids]
+44 -43
View File
@@ -1,7 +1,7 @@
function openerp_pos_widgets(instance, module){ //module is instance.point_of_sale
var QWeb = instance.web.qweb;
// The ImageCache is used to hide the latency of the application cache on-disk access in chrome
// The ImageCache is used to hide the latency of the application cache on-disk access in chrome
// that causes annoying flickering on product pictures. Why the hell a simple access to
// the application cache involves such latency is beyond me, hopefully one day this can be
// removed.
@@ -88,7 +88,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
},
});
// The paypad allows to select the payment method (cashRegisters)
// The paypad allows to select the payment method (cashRegisters)
// used to pay the order.
module.PaypadWidget = module.PosBaseWidget.extend({
template: 'PaypadWidget',
@@ -156,7 +156,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.trigger('order_line_refreshed');
},
});
module.OrderWidget = module.PosBaseWidget.extend({
template:'OrderWidget',
init: function(parent, options) {
@@ -168,18 +168,18 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.orderlinewidgets = [];
},
set_numpad_state: function(numpadState) {
if (this.numpadState) {
this.numpadState.unbind('set_value', this.set_value);
}
this.numpadState = numpadState;
if (this.numpadState) {
this.numpadState.bind('set_value', this.set_value, this);
this.numpadState.reset();
}
if (this.numpadState) {
this.numpadState.unbind('set_value', this.set_value);
}
this.numpadState = numpadState;
if (this.numpadState) {
this.numpadState.bind('set_value', this.set_value, this);
this.numpadState.reset();
}
},
set_value: function(val) {
var order = this.pos.get('selectedOrder');
if (order.get('orderLines').length !== 0) {
var order = this.pos.get('selectedOrder');
if (order.get('orderLines').length !== 0) {
var mode = this.numpadState.get('mode');
if( mode === 'quantity'){
order.getSelectedLine().set_quantity(val);
@@ -188,9 +188,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
}else if( mode === 'price'){
order.getSelectedLine().set_unit_price(val);
}
} else {
this.pos.get('selectedOrder').destroy();
}
} else {
this.pos.get('selectedOrder').destroy();
}
},
change_selected_order: function() {
this.currentOrderLines.unbind();
@@ -212,7 +212,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this._super();
// freeing subwidgets
if(this.scrollbar){
this.scrollbar.destroy();
}
@@ -235,7 +235,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
model: orderLine,
order: this.pos.get('selectedOrder'),
});
line.on('order_line_selected', self, self.update_numpad);
line.on('order_line_selected', self, self.update_numpad);
line.on('order_line_refreshed', self, self.update_summary);
line.appendTo($content);
self.orderlinewidgets.push(line);
@@ -245,7 +245,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
var position = this.scrollbar ? this.scrollbar.get_position() : 0;
var at_bottom = this.scrollbar ? this.scrollbar.is_at_bottom() : false;
this.scrollbar = new module.ScrollbarWidget(this,{
target_widget: this,
target_selector: '.order-scroller',
@@ -289,7 +289,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.model = options.model;
this.model.attributes.weight = options.weight;
this.next_screen = options.next_screen; //when a product is clicked, this screen is set
this.click_product_action = options.click_product_action;
this.click_product_action = options.click_product_action;
},
// returns the url of the product thumbnail
renderElement: function() {
@@ -319,11 +319,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.payment_line.set_amount(amount);
}
},
changedAmount: function() {
if (this.amount !== this.payment_line.get_amount()){
this.renderElement();
}
},
checkAmount:function(e){
if (e.which !== 0 && e.charCode !== 0) {
if(isNaN(String.fromCharCode(e.charCode))){
@@ -332,13 +327,19 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
}
return true
},
changedAmount: function() {
if (this.amount !== this.payment_line.get_amount()){
this.renderElement();
}
},
renderElement: function() {
var self = this;
this.name = this.payment_line.get_cashregister().get('journal_id')[1];
this._super();
this.$('input')
.keypress(_.bind(this.checkAmount, this))
.keyup(_.bind(this.changeAmount, this));
this.$('input').keypress(_.bind(this.checkAmount, this))
.keyup(function(event){
self.changeAmount(event);
});
this.$('.delete-payment-line').click(function() {
self.trigger('delete_payment_line', self);
});
@@ -550,7 +551,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
});
this.search_and_categories();
},
set_product_type: function(type){ // 'all' | 'weightable'
this.product_type = type;
this.reset_category();
@@ -618,11 +619,11 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this._super();
// free subwidgets memory from previous renders
for(var i = 0, len = this.productwidgets.length; i < len; i++){
this.productwidgets[i].destroy();
}
this.productwidgets = [];
this.productwidgets = [];
if(this.scrollbar){
this.scrollbar.destroy();
}
@@ -765,7 +766,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
});
_.each(this.events, function(name){
self.pos.proxy.add_notification(name,function(){
self.$('.event.'+name).stop().clearQueue().css({'background-color':'#6CD11D'});
self.$('.event.'+name).stop().clearQueue().css({'background-color':'#6CD11D'});
self.$('.event.'+name).animate({'background-color':'#1E1E1E'},2000);
});
});
@@ -821,7 +822,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
// The PosWidget is the main widget that contains all other widgets in the PointOfSale.
// It is mainly composed of :
// - a header, containing the list of orders
// - a leftpane, containing the list of bought products (orderlines)
// - a leftpane, containing the list of bought products (orderlines)
// - a rightpane, containing the screens (see pos_screens.js)
// - an actionbar on the bottom, containing various action buttons
// - popups
@@ -830,10 +831,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
module.PosWidget = module.PosBaseWidget.extend({
template: 'PosWidget',
init: function() {
init: function() {
this._super(arguments[0],{});
instance.web.blockUI();
instance.web.blockUI();
this.pos = new module.PosModel(this.session);
this.pos_widget = this; //So that pos_widget's childs have pos_widget set automatically
@@ -845,17 +846,17 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.cashier_controls_visible = true;
this.image_cache = new module.ImageCache(); // for faster products image display
},
start: function() {
var self = this;
return self.pos.ready.done(function() {
self.build_currency_template();
self.renderElement();
self.$('.neworder-button').click(function(){
self.pos.add_new_order();
});
//when a new order is created, add an order button widget
self.pos.get('orders').bind('add', function(new_order){
var new_order_button = new module.OrderButtonWidget(null, {
@@ -883,7 +884,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
}else if(!self.pos.get('pos_config')){
self.screen_selector.show_popup('error', 'Sorry, we could not find any PoS Configuration for this session');
}
instance.web.unblockUI();
self.$('.loader').animate({opacity:0},1500,'swing',function(){self.$('.loader').hide();});
@@ -901,7 +902,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
}, self));
});
},
// This method instantiates all the screens, widgets, etc. If you want to add new screens change the
// startup screen, etc, override this method.
build_widgets: function() {
@@ -976,7 +977,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.onscreen_keyboard = new module.OnscreenKeyboardWidget(this, {
'keyboard_model': 'simple'
});
this.onscreen_keyboard.appendTo($(".point-of-sale #content"));
this.onscreen_keyboard.appendTo($(".point-of-sale #content"));
this.close_button = new module.HeaderButtonWidget(this,{
label:'Close',
@@ -990,7 +991,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
});
this.client_button.appendTo(this.$('#rightheader'));
// -------- Screen Selector ---------
this.screen_selector = new module.ScreenSelector({
@@ -1075,7 +1076,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
}
}
},
//shows or hide the controls in the PosWidget that are specific to the cashier ( Orders, close button, etc. )
//shows or hide the controls in the PosWidget that are specific to the cashier ( Orders, close button, etc. )
set_cashier_controls_visible: function(visible){
if(visible !== this.cashier_controls_visible){
this.cashier_controls_visible = visible;