[FORWARD] Forward-port of addons saas-1 until revision 8775 (revid tde@openerp.com-20130913092546-kzshg1a7sls566l8).

[FIX] account: trunk version of the fix added in version 9440 of 7.0 branch

bzr revid: tde@openerp.com-20130913095612-i2f0kd3mhxdavdp6
This commit is contained in:
Thibault Delavallée 2013-09-13 11:56:12 +02:00
commit 2f9980881b
9 changed files with 42 additions and 28 deletions

View File

@ -3089,7 +3089,9 @@ class wizard_multi_charts_accounts(osv.osv_memory):
#in order to get set default chart which was last created set max of ids.
chart_id = max(ids)
if context.get("default_charts"):
chart_id = self.pool.get('ir.model.data').search_read(cr, uid, [('model','=','account.chart.template'),('module','=',context.get("default_charts"))], ['res_id'], context=context)[0]['res_id']
model_data = self.pool.get('ir.model.data').search_read(cr, uid, [('model','=','account.chart.template'),('module','=',context.get("default_charts"))], ['res_id'], context=context)
if model_data:
chart_id = model_data[0]['res_id']
res.update({'only_one_chart_template': len(ids) == 1, 'chart_template_id': chart_id})
if 'sale_tax' in fields:
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"

View File

@ -151,24 +151,18 @@ class pos_details(report_sxw.rml_parse):
return self._ellipsis(name, maxlen, ' ...')
def _get_tax_amount(self, form):
res = {}
temp = {}
list_ids = []
temp2 = 0.0
taxes = {}
account_tax_obj = self.pool.get('account.tax')
user_ids = form['user_ids'] or self._get_all_users()
pos_order_obj = self.pool.get('pos.order')
pos_ids = pos_order_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','in',user_ids)])
temp.update({'name': ''})
for order in pos_order_obj.browse(self.cr, self.uid, pos_ids):
temp2 += order.amount_tax
for line in order.lines:
if len(line.product_id.taxes_id):
tax = line.product_id.taxes_id[0]
res[tax.name] = (line.price_unit * line.qty * (1-(line.discount or 0.0) / 100.0)) + (tax.id in list_ids and res[tax.name] or 0)
list_ids.append(tax.id)
temp.update({'name': tax.name})
temp.update({'amount': temp2})
return [temp] or False
line_taxes = account_tax_obj.compute_all(self.cr, self.uid, line.product_id.taxes_id, line.price_unit, line.qty, product=line.product_id, partner=line.order_id.partner_id or False)
for tax in line_taxes['taxes']:
taxes.setdefault(tax['id'], {'name': tax['name'], 'amount':0.0})
taxes[tax['id']]['amount'] += tax['amount']
return [value for value in taxes.values()] or False
def _get_user_names(self, user_ids):
user_obj = self.pool.get('res.users')

View File

@ -582,6 +582,7 @@
background:#fff;
border: 1px solid #fff;
border-radius: 3px;
overflow: hidden;
-webkit-box-shadow: 0px 2px 0px #dad8e4, 0px 1px 8px #636480;
-moz-box-shadow: 0px 2px 0px #dad8e4, 0px 1px 8px #636480;
box-shadow: 0px 2px 0px #dad8e4, 0px 1px 8px #636480;
@ -623,6 +624,8 @@
top:auto;
line-height: 14px;
width:100%;
overflow: hidden;
text-overflow: ellipsis;
background: -webkit-linear-gradient(-90deg,rgba(255,255,255,0),rgba(255,255,255,1), rgba(255,255,255,1));
background: -moz-linear-gradient(-90deg,rgba(255,255,255,0),rgba(255,255,255,1), rgba(255,255,255,1));
background: -ms-linear-gradient(-90deg,rgba(255,255,255,0),rgba(255,255,255,1), rgba(255,255,255,1));
@ -800,9 +803,11 @@
.point-of-sale .pos-sale-ticket table {
width: 100%;
border: 0;
table-layout: fixed;
}
.point-of-sale .pos-sale-ticket table td {
border: 0;
word-wrap: break-word;
}
@media print {
@ -901,14 +906,16 @@
.point-of-sale .scale-screen .product-name {
position: absolute;
left:0;
left:40px;
top:50px;
height:50px;
font-size:40px;
font-size:36px;
line-height:50px;
text-align:right;
right:275px;
color: #8d8d8d;
overflow: hidden;
text-overflow: ellipsis;
}
.point-of-sale .scale-screen .weight{
position: absolute;
@ -1072,6 +1079,7 @@
font-weight: bold;
width:80%;
overflow:hidden;
text-overflow: ellipsis;
}
.point-of-sale .order .orderline .price{
padding:0;

View File

@ -150,6 +150,9 @@ function openerp_pos_db(instance, module){
if(product.ean13){
str += '|' + product.ean13;
}
if(product.default_code){
str += '|' + product.default_code;
}
var packagings = this.packagings_by_product_id[product.id] || [];
for(var i = 0; i < packagings.length; i++){
str += '|' + packagings[i].ean;

View File

@ -182,7 +182,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
return self.fetch(
'product.product',
['name', 'list_price','price','pos_categ_id', 'taxes_id', 'ean13',
['name', 'list_price','price','pos_categ_id', 'taxes_id', 'ean13', 'default_code',
'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description'],
[['sale_ok','=',true],['available_in_pos','=',true]],
{pricelist: self.get('pos_config').pricelist_id[0]} // context for price

View File

@ -750,9 +750,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
this.product_categories_widget.reset_category();
this.pos_widget.order_widget.set_numpad_state(this.pos_widget.numpad.state);
if(this.pos.iface_vkeyboard){
this.pos_widget.onscreen_keyboard.connect();
}
if(this.pos_widget.screen_selector.current_mode === 'client'){
this.add_action_button({
@ -769,6 +766,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
this._super();
this.pos_widget.order_widget.set_numpad_state(null);
this.pos_widget.payment_screen.set_numpad_state(null);
if(this.pos.iface_vkeyboard && this.pos_widget.onscreen_keyboard){
this.pos_widget.onscreen_keyboard.hide();
}
},
});

View File

@ -27,9 +27,7 @@ function openerp_pos_keyboard(instance, module){ //module is instance.point_of_s
}
this.input_selector = options.input_selector || '.searchbox input';
//show the keyboard when the input zone is clicked.
$(this.input_selector).focus(function(){self.show();});
this.$target = null;
//Keyboard state
this.capslock = false;
@ -37,14 +35,15 @@ function openerp_pos_keyboard(instance, module){ //module is instance.point_of_s
this.numlock = false;
},
connect : function(){
connect : function($target){
var self = this;
$(this.input_selector).focus(function(){self.show();});
this.$target = $target;
$target.focus(function(){self.show();});
},
// Write a character to the input zone
writeCharacter: function(character){
var $input = $(this.input_selector);
var $input = this.$target
$input[0].value += character;
$input.keydown();
$input.keyup();
@ -56,7 +55,7 @@ function openerp_pos_keyboard(instance, module){ //module is instance.point_of_s
// Removes the last character from the input zone.
deleteCharacter: function(){
var $input = $(this.input_selector);
var $input = this.$target;
var input_value = $input[0].value;
$input[0].value = input_value.substr(0, input_value.length - 1);
$input.keydown();
@ -65,7 +64,7 @@ function openerp_pos_keyboard(instance, module){ //module is instance.point_of_s
// Clears the content of the input zone.
deleteAllCharacters: function(){
var $input = $(this.input_selector);
var $input = this.$target;
$input[0].value = "";
$input.keydown();
$input.keyup();

View File

@ -543,6 +543,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
self.renderElement();
self.search_and_categories(category);
});
if(this.pos.iface_vkeyboard && this.pos_widget.onscreen_keyboard){
this.pos_widget.onscreen_keyboard.connect(this.$('.searchbox input'));
}
this.search_and_categories();
},

View File

@ -593,6 +593,11 @@
Shop: <t t-esc="widget.shop_obj.name"/><br />
<br />
<table>
<colgroup>
<col width='50%' />
<col width='25%' />
<col width='25%' />
</colgroup>
<tr t-foreach="widget.currentOrderLines.toArray()" t-as="orderline">
<td>
<t t-esc="orderline.get_product().get('name')"/>