[MERGE] forward port branch saas-11 up to 7842498
This commit is contained in:
@@ -63,3 +63,9 @@ class AccountInvoiceLine(models.Model):
|
||||
fields.Date.today(), company_id=self.company_id.id)
|
||||
self.account_analytic_id = rec.analytic_id.id
|
||||
return res
|
||||
|
||||
def _set_additional_fields(self, invoice):
|
||||
rec = self.env['account.analytic.default'].account_get(self.product_id.id, self.invoice_id.partner_id.id, self.env.uid,
|
||||
fields.Date.today(), company_id=self.company_id.id)
|
||||
self.account_analytic_id = rec.analytic_id.id
|
||||
super(AccountInvoiceLine, self)._set_additional_fields(invoice)
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Employee">
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box" groups="hr.group_hr_user">
|
||||
<button name="toggle_active" type="object"
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="toggle_active" type="object" groups="hr.group_hr_user"
|
||||
class="oe_stat_button" icon="fa-archive">
|
||||
<field name="active" widget="boolean_button"
|
||||
options='{"terminology": "archive"}'/>
|
||||
|
||||
@@ -389,7 +389,8 @@
|
||||
<button name="%(act_hr_employee_payslip_list)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-money"
|
||||
type="action">
|
||||
type="action"
|
||||
groups="hr.group_hr_user">
|
||||
<field name="payslip_count" widget="statinfo" string="Payslips"/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,13 @@ from odoo import api, fields, models
|
||||
class Invoice(models.Model):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
@api.multi
|
||||
def action_cancel_draft(self):
|
||||
self.env['membership.membership_line'].search([
|
||||
('account_invoice_line', 'in', self.mapped('invoice_line_ids').ids)
|
||||
]).write({'date_cancel': False})
|
||||
return super(Invoice, self).action_cancel_draft()
|
||||
|
||||
@api.multi
|
||||
def action_cancel(self):
|
||||
'''Create a 'date_cancel' on the membership_line object'''
|
||||
|
||||
@@ -156,6 +156,7 @@ class AccountInvoice(models.Model):
|
||||
valuation_price_unit_total += val_stock_move.price_unit * val_stock_move.product_qty
|
||||
valuation_total_qty += val_stock_move.product_qty
|
||||
valuation_price_unit = valuation_price_unit_total / valuation_total_qty
|
||||
valuation_price_unit = i_line.product_id.uom_id._compute_price(valuation_price_unit, i_line.uom_id)
|
||||
if inv.currency_id.id != company_currency.id:
|
||||
valuation_price_unit = company_currency.with_context(date=inv.date_invoice).compute(valuation_price_unit, inv.currency_id)
|
||||
if valuation_price_unit != i_line.price_unit and line['price_unit'] == i_line.price_unit and acc:
|
||||
|
||||
@@ -164,16 +164,24 @@ function parse_value (value, descriptor, value_if_empty) {
|
||||
if (datetime.isValid())
|
||||
return time.datetime_to_str(datetime.toDate());
|
||||
datetime = moment(value, [date_pattern + ' ' + time_pattern, date_pattern_wo_zero + ' ' + time_pattern_wo_zero, moment.ISO_8601]);
|
||||
if (datetime.isValid())
|
||||
if (datetime.isValid()) {
|
||||
if (datetime.year() === 0) {
|
||||
datetime.year(moment.utc().year());
|
||||
}
|
||||
return time.datetime_to_str(datetime.toDate());
|
||||
}
|
||||
throw new Error(_.str.sprintf(_t("'%s' is not a correct datetime"), value));
|
||||
case 'date':
|
||||
var date = moment(value, [date_pattern, date_pattern_wo_zero, moment.ISO_8601], true);
|
||||
if (date.isValid())
|
||||
return time.date_to_str(date.toDate());
|
||||
date = moment(value, [date_pattern, date_pattern_wo_zero, moment.ISO_8601]);
|
||||
if (date.isValid())
|
||||
if (date.isValid()) {
|
||||
if (date.year() === 0) {
|
||||
date.year(moment.utc().year());
|
||||
}
|
||||
return time.date_to_str(date.toDate());
|
||||
}
|
||||
throw new Error(_.str.sprintf(_t("'%s' is not a correct date"), value));
|
||||
case 'time':
|
||||
var _time = moment(value, [time_pattern, time_pattern_wo_zero, moment.ISO_8601], true);
|
||||
|
||||
@@ -28,9 +28,7 @@ var TranslationDataBase = Class.extend(/** @lends instance.TranslationDataBase#
|
||||
});
|
||||
if (translation_bundle.lang_parameters) {
|
||||
this.parameters = translation_bundle.lang_parameters;
|
||||
if (typeof(py) !== "undefined") {
|
||||
this.parameters.grouping = py.eval(this.parameters.grouping);
|
||||
}
|
||||
this.parameters.grouping = JSON.parse(this.parameters.grouping);
|
||||
}
|
||||
},
|
||||
add_module_translation: function(mod) {
|
||||
|
||||
@@ -16,7 +16,7 @@ class WebsiteConfigSettings(models.TransientModel):
|
||||
website_name = fields.Char('Website Name', related='website_id.name')
|
||||
|
||||
language_ids = fields.Many2many(related='website_id.language_ids', relation='res.lang')
|
||||
default_lang_id = fields.Many2one(related='website_id.default_lang_id', relation='res.lang')
|
||||
default_lang_id = fields.Many2one(related='website_id.default_lang_id', relation='res.lang', required=True)
|
||||
default_lang_code = fields.Char('Default language code', related='website_id.default_lang_code')
|
||||
google_analytics_key = fields.Char('Google Analytics Key', related='website_id.google_analytics_key')
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ class Website(models.Model):
|
||||
domain = fields.Char('Website Domain')
|
||||
company_id = fields.Many2one('res.company', string="Company", default=lambda self: self.env.ref('base.main_company').id)
|
||||
language_ids = fields.Many2many('res.lang', 'website_lang_rel', 'website_id', 'lang_id', 'Languages', default=_active_languages)
|
||||
default_lang_id = fields.Many2one('res.lang', string="Default Language", default=_default_language)
|
||||
default_lang_id = fields.Many2one('res.lang', string="Default Language", default=_default_language, required=True)
|
||||
default_lang_code = fields.Char(related='default_lang_id.code', string="Default language code", store=True)
|
||||
|
||||
social_twitter = fields.Char('Twitter Account')
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" name="website_publish_button"
|
||||
type="object" icon="fa-globe">
|
||||
type="object" icon="fa-globe" groups="base.group_hr_user">
|
||||
<field name="website_published" widget="website_button"/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -119,11 +119,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div t-attf-class="form-group #{error.get('name') and 'has-error' or ''} col-lg-6">
|
||||
<label class="control-label" for="contact_name">Your Name</label>
|
||||
<label class="control-label" for="name">Your Name</label>
|
||||
<input type="text" name="name" class="form-control" t-att-value="name or partner.name" />
|
||||
</div>
|
||||
<div t-attf-class="form-group #{error.get('email') and 'has-error' or ''} col-lg-6">
|
||||
<label class="control-label" for="contact_name">Email</label>
|
||||
<label class="control-label" for="email">Email</label>
|
||||
<input type="email" name="email" class="form-control" t-att-value="email or partner.email" />
|
||||
</div>
|
||||
<div t-attf-class="form-group #{error.get('phone') and 'has-error' or ''} col-lg-6">
|
||||
|
||||
@@ -49,6 +49,7 @@ odoo.define('website_sale.cart', function (require) {
|
||||
odoo.define('website_sale.website_sale_category', function (require) {
|
||||
"use strict";
|
||||
|
||||
var utils = require('web.utils');
|
||||
var base = require('web_editor.base');
|
||||
|
||||
if(!$('#o_shop_collapse_category').length) {
|
||||
@@ -226,9 +227,15 @@ odoo.define('website_sale.website_sale', function (require) {
|
||||
});
|
||||
|
||||
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 = _t.database.parameters;
|
||||
var precision = 2;
|
||||
|
||||
if ($(".decimal_precision").length) {
|
||||
precision = parseInt($(".decimal_precision").first().data('precision'));
|
||||
}
|
||||
var formatted = _.str.sprintf('%.' + precision + 'f', price).split('.');
|
||||
formatted[0] = utils.insert_thousand_seps(formatted[0]);
|
||||
return formatted.join(l10n.decimal_point);
|
||||
}
|
||||
|
||||
function update_product_image(event_source, product_id) {
|
||||
|
||||
@@ -589,7 +589,7 @@
|
||||
<span itemprop="price" style="display:none;" t-esc="product.website_price"/>
|
||||
<span itemprop="priceCurrency" style="display:none;" t-esc="website.currency_id.name"/>
|
||||
</h4>
|
||||
<h4 class="css_non_editable_mode_hidden">
|
||||
<h4 class="css_non_editable_mode_hidden decimal_precision" t-att-data-precision="product.currency_id.decimal_places">
|
||||
<span t-field="product.lst_price"
|
||||
t-options='{
|
||||
"widget": "monetary",
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
Spain, 2016-11-21
|
||||
|
||||
Diagram Software, S.L. agrees to the terms of the Odoo Corporate Contributor License
|
||||
Agreement v1.0.
|
||||
|
||||
I declare that I am authorized and able to make this agreement and sign this
|
||||
declaration.
|
||||
|
||||
Signed,
|
||||
|
||||
Jose Zambudio jose.zambudio@diagram.es https://github.com/zamberjo
|
||||
|
||||
List of contributors:
|
||||
|
||||
Cristian Moncho cristian.moncho@diagram.es https://github.com/crimoniv
|
||||
Jose Zambudio jose.zambudio@diagram.es https://github.com/zamberjo
|
||||
Almudena de la Puente almudena.delapuente@diagram.es https://github.com/almumu
|
||||
Mauro Cebriá mauro.cebria@diagram.es https://github.com/maurochip
|
||||
Pedro Albujer pedro.albujer.rico@diagram.es https://github.com/P4R
|
||||
Rubén Cerdà ruben.cerda.roig@diagram.es https://github.com/rubencr7
|
||||
@@ -12,7 +12,7 @@ import urlparse
|
||||
from email.utils import formataddr
|
||||
from lxml import etree
|
||||
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo import api, fields, models, tools, SUPERUSER_ID, _
|
||||
from odoo.modules import get_module_resource
|
||||
from odoo.osv.expression import get_unaccent_wrapper
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
@@ -490,7 +490,12 @@ class Partner(models.Model, FormatAddress):
|
||||
raise UserError(_("You can not change the company as the partner/user has multiple user linked with different companies."))
|
||||
tools.image_resize_images(vals)
|
||||
|
||||
result = super(Partner, self).write(vals)
|
||||
result = True
|
||||
# To write in SUPERUSER on field is_company and avoid access rights problems.
|
||||
if 'is_company' in vals and self.user_has_groups('base.group_partner_manager') and not self.env.uid == SUPERUSER_ID:
|
||||
result = super(Partner, self).sudo().write({'is_company': vals.get('is_company')})
|
||||
del vals['is_company']
|
||||
result = result and super(Partner, self).write(vals)
|
||||
for partner in self:
|
||||
if any(u.has_group('base.group_user') for u in partner.user_ids if u != self.env.user):
|
||||
self.env['res.users'].check_access_rights('write')
|
||||
|
||||
@@ -1131,6 +1131,8 @@ def formatLang(env, value, digits=None, grouping=True, monetary=False, dp=False,
|
||||
if dp:
|
||||
decimal_precision_obj = env['decimal.precision']
|
||||
digits = decimal_precision_obj.precision_get(dp)
|
||||
elif currency_obj:
|
||||
digits = currency_obj.decimal_places
|
||||
elif (hasattr(value, '_field') and isinstance(value._field, (float_field, function_field)) and value._field.digits):
|
||||
digits = value._field.digits[1]
|
||||
if not digits and digits is not 0:
|
||||
|
||||
Reference in New Issue
Block a user