[MERGE] forward port branch 8.0 up to 0105cbb
This commit is contained in:
@@ -476,6 +476,15 @@ class Invoice(osv.osv):
|
||||
'''Invoice'''
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
def action_cancel_draft(self, cr, uid, ids, context=None):
|
||||
member_line_obj = self.pool.get('membership.membership_line')
|
||||
for invoice in self.browse(cr, uid, ids, context=context):
|
||||
mlines = member_line_obj.search(cr, uid,
|
||||
[('account_invoice_line', 'in',
|
||||
[l.id for l in invoice.invoice_line])])
|
||||
member_line_obj.write(cr, uid, mlines, {'date_cancel': False}, context=context)
|
||||
return super(Invoice, self).action_cancel_draft(cr, uid, ids, context=context)
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
'''Create a 'date_cancel' on the membership_line object'''
|
||||
member_line_obj = self.pool.get('membership.membership_line')
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
-
|
||||
!python {model: ir.values}: |
|
||||
whr = self.pool.get('stock.warehouse').browse(cr, uid, ref('stock.warehouse0'), context=context)
|
||||
self.set_default(cr, uid, 'purchase.order', 'picking_type_id', whr.in_type_id.id, for_all_users=True, company_id=True, condition=False)
|
||||
-
|
||||
!python {model: stock.warehouse}: |
|
||||
#enable purchase on main warehouse
|
||||
|
||||
@@ -10,7 +10,7 @@ class website_config_settings(osv.osv_memory):
|
||||
'website_name': fields.related('website_id', 'name', type="char", string="Website Name"),
|
||||
|
||||
'language_ids': fields.related('website_id', 'language_ids', type='many2many', relation='res.lang', string='Languages'),
|
||||
'default_lang_id': fields.related('website_id', 'default_lang_id', type='many2one', relation='res.lang', string='Default language'),
|
||||
'default_lang_id': fields.related('website_id', 'default_lang_id', type='many2one', relation='res.lang', string='Default language', required=True),
|
||||
'default_lang_code': fields.related('website_id', 'default_lang_code', type="char", string="Default language code"),
|
||||
'google_analytics_key': fields.related('website_id', 'google_analytics_key', type="char", string='Google Analytics Key'),
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ class website(osv.osv):
|
||||
'domain': fields.char('Website Domain'),
|
||||
'company_id': fields.many2one('res.company', string="Company"),
|
||||
'language_ids': fields.many2many('res.lang', 'website_lang_rel', 'website_id', 'lang_id', 'Languages'),
|
||||
'default_lang_id': fields.many2one('res.lang', string="Default language"),
|
||||
'default_lang_id': fields.many2one('res.lang', string="Default language", required=True),
|
||||
'default_lang_code': fields.related('default_lang_id', 'code', type="char", string="Default language code", store=True),
|
||||
'social_twitter': fields.char('Twitter Account'),
|
||||
'social_facebook': fields.char('Facebook Account'),
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
Capacity: 16GB
|
||||
Connectivity: Wifi
|
||||
Beautiful 7.9-inch display
|
||||
Over 375,000 apps3
|
||||
Over 375,000 apps
|
||||
Ultrafast wireless
|
||||
iOS7
|
||||
</field>
|
||||
|
||||
@@ -77,13 +77,13 @@ $('.oe_website_sale').each(function () {
|
||||
'line_id': line_id})
|
||||
.then(function (res) {
|
||||
//basic case
|
||||
$dom.find('span.oe_currency_value').last().text(res[product_id].toFixed(2));
|
||||
$dom.find('span.oe_currency_value').last().text(price_to_str(res[product_id]));
|
||||
$dom.find('.text-danger').toggle(res[product_id]<default_price && (default_price-res[product_id] > default_price/100));
|
||||
//optional case
|
||||
$dom_optional.each(function(){
|
||||
var id = $(this).find('span[data-product-id]').data('product-id');
|
||||
var price = parseFloat($(this).find(".text-danger > span.oe_currency_value").text());
|
||||
$(this).find("span.oe_currency_value").last().text(res[id].toFixed(2));
|
||||
$(this).find("span.oe_currency_value").last().text(price_to_str(res[id]));
|
||||
$(this).find('.text-danger').toggle(res[id]<price && (price-res[id]>price/100));
|
||||
});
|
||||
openerp.jsonRpc("/shop/cart/update_json", 'call', {
|
||||
@@ -166,10 +166,47 @@ $('.oe_website_sale').each(function () {
|
||||
$('.css_attribute_color:has(input:checked)').addClass("active");
|
||||
});
|
||||
|
||||
// Copy from core.js that is not available in front end.
|
||||
function intersperse(str, indices, separator) {
|
||||
separator = separator || '';
|
||||
var result = [], last = str.length;
|
||||
|
||||
for(var i=0; i<indices.length; ++i) {
|
||||
var section = indices[i];
|
||||
if (section === -1 || last <= 0) { break; }
|
||||
else if(section === 0 && i === 0) { break; }
|
||||
else if (section === 0) { section = indices[--i]; }
|
||||
result.push(str.substring(last-section, last));
|
||||
last -= section;
|
||||
}
|
||||
var s = str.substring(0, last);
|
||||
if (s) { result.push(s); }
|
||||
return result.reverse().join(separator);
|
||||
}
|
||||
function insert_thousand_seps(num) {
|
||||
var l10n = openerp._t.database.parameters;
|
||||
var negative = num[0] === '-';
|
||||
num = (negative ? num.slice(1) : num);
|
||||
|
||||
return (negative ? '-' : '') + intersperse(
|
||||
num, l10n.grouping, l10n.thousands_sep);
|
||||
}
|
||||
|
||||
function price_to_str(price) {
|
||||
price = Math.round(price * 100) / 100;
|
||||
var dec = Math.round((price % 1) * 100);
|
||||
return price + (dec ? '' : '.0') + (dec%10 ? '' : '0');
|
||||
var l10n = openerp._t.database.parameters;
|
||||
var precision = 2;
|
||||
if ($(".decimal_precision").length) {
|
||||
var dec_precision = $(".decimal_precision").first().data('precision');
|
||||
//MAth.log10 is not implemented in phantomJS
|
||||
dec_precision = Math.round(Math.log(1/parseFloat(dec_precision))/Math.log(10));
|
||||
if (!isNaN(dec_precision)) {
|
||||
precision = dec_precision;
|
||||
}
|
||||
}
|
||||
var formatted = _.str.sprintf('%.' + precision + 'f', price).split('.');
|
||||
formatted[0] = insert_thousand_seps(formatted[0]);
|
||||
var ret = formatted.join(l10n.decimal_point);
|
||||
return ret;
|
||||
}
|
||||
|
||||
$(oe_website_sale).on('change', 'input.js_product_change', function (ev) {
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
}'>
|
||||
</span>
|
||||
<span itemprop="price" style="display:none;" t-esc="product.price"/>
|
||||
<span itemprop="priceCurrency" style="display:none;" t-esc="user_id.partner_id.property_product_pricelist.currency_id.name"/>
|
||||
<span itemprop="priceCurrency" style="display:none;" t-esc="user_id.partner_id.property_product_pricelist.currency_id.name" class='decimal_precision' t-att-data-precision="website.pricelist_id.currency_id.rounding"/>
|
||||
</b>
|
||||
</div>
|
||||
</section>
|
||||
@@ -380,7 +380,7 @@
|
||||
"display_currency": "user_id.partner_id.property_product_pricelist.currency_id"
|
||||
}'/>
|
||||
<span itemprop="price" style="display:none;" t-esc="product.price"/>
|
||||
<span itemprop="priceCurrency" style="display:none;" t-esc="user_id.partner_id.property_product_pricelist.currency_id.name"/>
|
||||
<span itemprop="priceCurrency" style="display:none;" t-esc="user_id.partner_id.property_product_pricelist.currency_id.name" class='decimal_precision' t-att-data-precision="website.pricelist_id.currency_id.rounding"/>
|
||||
</h4>
|
||||
<h4 class="css_non_editable_mode_hidden">
|
||||
<span t-field="product.lst_price"
|
||||
@@ -599,7 +599,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" width="100">Product</th>
|
||||
<th width="100">Price</th>
|
||||
<th width="100" class='decimal_precision' t-att-data-precision="website_sale_order.pricelist_id.currency_id.rounding">Price</th>
|
||||
<th width="120">Quantity</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Reference in New Issue
Block a user