[MERGE] forward port branch 11.0 up to 5a943390f2

This commit is contained in:
Christophe Simonis
2018-05-15 20:18:14 +02:00
17 changed files with 74 additions and 26 deletions
@@ -18,7 +18,7 @@ class TaxAdjustments(models.TransientModel):
debit_account_id = fields.Many2one('account.account', string='Debit account', required=True, domain=[('deprecated', '=', False)])
credit_account_id = fields.Many2one('account.account', string='Credit account', required=True, domain=[('deprecated', '=', False)])
amount = fields.Monetary(currency_field='company_currency_id', required=True)
adjustment_type = fields.Selection([('debit', 'Adjustment in favor of the Estate'), ('credit', 'Adjustment in your favor')], string="Adjustment Type", store=False, required=True)
adjustment_type = fields.Selection([('debit', 'Applied on debit journal item'), ('credit', 'Applied on credit journal item')], string="Adjustment Type", store=False, required=True)
company_currency_id = fields.Many2one('res.currency', readonly=True, default=lambda self: self.env.user.company_id.currency_id)
tax_id = fields.Many2one('account.tax', string='Adjustment Tax', ondelete='restrict', domain=[('type_tax_use', '=', 'adjustment')], required=True)
+1 -1
View File
@@ -159,7 +159,7 @@ class PaymentTransaction(models.Model):
'currency_id': invoice.currency_id.id,
'partner_id': invoice.partner_id.id,
'partner_country_id': invoice.partner_id.country_id.id,
'reference': self.get_next_reference(invoice.number),
'reference': self._get_next_reference(invoice.number, acquirer=acquirer),
'account_invoice_id': invoice.id,
}
if add_tx_values:
+2 -1
View File
@@ -96,9 +96,10 @@ class SaleOrder(models.Model):
taxes_ids = self.fiscal_position_id.map_tax(taxes, carrier.product_id, self.partner_id).ids
# Create the sales order line
carrier_name = carrier.product_id.with_context(lang=self.partner_id.lang).name_get()[0][1]
values = {
'order_id': self.id,
'name': carrier.name,
'name': carrier_name,
'product_uom_qty': 1,
'product_uom': carrier.product_id.uom_id.id,
'product_id': carrier.product_id.id,
+1 -1
View File
@@ -5,7 +5,7 @@ access_event_event_portal,event.event.portal,model_event_event,,1,0,0,0
access_event_event_user,event.event.user,model_event_event,event.group_event_user,1,0,0,0
access_event_event_manager,event.event.manager,model_event_event,event.group_event_manager,1,1,1,1
access_event_registration,event.registration,model_event_registration,event.group_event_user,1,1,1,1
access_event_registration_portal,event.registration,model_event_registration,,1,0,0,0
access_event_registration_portal,event.registration,model_event_registration,,0,0,0,0
access_event_mail,event.mail,model_event_mail,event.group_event_user,1,0,0,0
access_event_mail_manager,event.mail manager,model_event_mail,event.group_event_manager,1,1,1,1
access_event_mail_registration,event.mail.registration,model_event_mail_registration,event.group_event_user,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
5 access_event_event_user event.event.user model_event_event event.group_event_user 1 0 0 0
6 access_event_event_manager event.event.manager model_event_event event.group_event_manager 1 1 1 1
7 access_event_registration event.registration model_event_registration event.group_event_user 1 1 1 1
8 access_event_registration_portal event.registration model_event_registration 1 0 0 0 0
9 access_event_mail event.mail model_event_mail event.group_event_user 1 0 0 0
10 access_event_mail_manager event.mail manager model_event_mail event.group_event_manager 1 1 1 1
11 access_event_mail_registration event.mail.registration model_event_mail_registration event.group_event_user 1 0 0 0
+1 -1
View File
@@ -41,7 +41,7 @@ class SaleOrderLine(models.Model):
order line has a product_uom_qty attribute that will be the number of
registrations linked to this line. This method update existing registrations
and create new one for missing one. """
Registration = self.env['event.registration']
Registration = self.env['event.registration'].sudo()
registrations = Registration.search([('sale_order_line_id', 'in', self.ids), ('state', '!=', 'cancel')])
for so_line in self.filtered('event_id'):
existing_registrations = registrations.filtered(lambda self: self.sale_order_line_id.id == so_line.id)
+2 -6
View File
@@ -85,11 +85,6 @@ class HolidaysRequest(models.Model):
('date_check', "CHECK ( number_of_days_temp >= 0 )", "The number of days must be greater than 0."),
]
@api.onchange('employee_id')
def _onchange_employee_id(self):
self.manager_id = self.employee_id and self.employee_id.parent_id
self.department_id = self.employee_id.department_id
@api.multi
@api.depends('number_of_days_temp')
def _compute_number_of_days(self):
@@ -121,7 +116,8 @@ class HolidaysRequest(models.Model):
self.department_id = None
@api.onchange('employee_id')
def _onchange_employee(self):
def _onchange_employee_id(self):
self.manager_id = self.employee_id and self.employee_id.parent_id
if self.holiday_type == 'employee':
self.department_id = self.employee_id.department_id
@@ -687,6 +687,10 @@ class PaymentTransaction(models.Model):
@api.model
def get_next_reference(self, reference):
return self._get_next_reference(reference)
@api.model
def _get_next_reference(self, reference, acquirer=None):
ref_suffix = 1
init_ref = reference
while self.env['payment.transaction'].sudo().search_count([('reference', '=', reference)]):
+11
View File
@@ -4,6 +4,7 @@
import json
import logging
import re
from hashlib import sha256
from werkzeug import urls
@@ -111,6 +112,16 @@ class AcquirerSips(models.Model):
return self.environment == 'prod' and self.sips_prod_url or self.sips_test_url
class PaymentTransactionSips(models.Model):
_inherit = 'payment.transaction'
@api.model
def _get_next_reference(self, reference, acquirer=None):
if acquirer and acquirer.provider == 'sips':
reference = re.sub(r'[^0-9a-zA-Z]+', 'x' , reference)
return super(PaymentTransactionSips, self)._get_next_reference(reference, acquirer=acquirer)
class TxSips(models.Model):
_inherit = 'payment.transaction'
+5
View File
@@ -21,6 +21,11 @@ class ProductTemplate(models.Model):
raise UserError(_('You cannot delete a product saleable in point of sale while a session is still opened.'))
return super(ProductTemplate, self).unlink()
@api.onchange('sale_ok')
def _onchange_sale_ok(self):
if not self.sale_ok:
self.available_in_pos = False
class ProductUomCateg(models.Model):
_inherit = 'product.uom.categ'
+6
View File
@@ -1020,6 +1020,12 @@ msgstr ""
msgid "Ending Date"
msgstr ""
#. module: project
#: code:addons/project/models/project.py:556
#, python-format
msgid "Error! You cannot create recursive hierarchy of task(s)."
msgstr ""
#. module: project
#: sql_constraint:project.project:0
msgid "Error! project start-date must be lower than project end-date."
+20
View File
@@ -641,6 +641,12 @@ class Task(models.Model):
default['remaining_hours'] = self.planned_hours
return super(Task, self).copy(default)
@api.constrains('parent_id')
def _check_parent_id(self):
for task in self:
if not task._check_recursion():
raise ValidationError(_('Error! You cannot create recursive hierarchy of task(s).'))
# Override view according to the company definition
@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
@@ -1002,6 +1008,20 @@ class Task(models.Model):
'type': 'ir.actions.act_window'
}
def action_subtask(self):
action = self.env.ref('project.project_task_action_sub_task').read()[0]
ctx = self.env.context.copy()
ctx.update({
'default_parent_id': self.id,
'default_project_id': self.env.context.get('project_id', self.project_id.id),
'default_name': self.env.context.get('name', self.name) + ':',
'default_partner_id': self.env.context.get('partner_id', self.partner_id.id),
'search_default_project_id': self.env.context.get('project_id', self.project_id.id),
})
action['context'] = ctx
action['domain'] = [('id', 'child_of', self.id), ('id', '!=', self.id)]
return action
# ---------------------------------------------------
# Rating business
# ---------------------------------------------------
+1 -9
View File
@@ -84,14 +84,6 @@
<field name="name">Sub-tasks</field>
<field name="res_model">project.task</field>
<field name="view_mode">kanban,tree,form,calendar,pivot,graph</field>
<field name="domain">[('id', 'child_of', active_id), ('id', '!=', active_id)]</field>
<field name="context">
{
'default_parent_id' : active_id,
'default_project_id' : project_id,
'default_name' : name + ':',
}
</field>
<field name="search_view_id" ref="project.view_task_search_form"/>
</record>
@@ -424,7 +416,7 @@
<sheet string="Task">
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" icon="fa-tasks" type="object" name="action_open_parent_task" string="Parent Task" attrs="{'invisible' : [('parent_id', '=', False)]}" groups="project.group_subtask_project"/>
<button id="subtask_stat_button" name="%(project_task_action_sub_task)d" type="action" class="oe_stat_button" icon="fa-tasks"
<button name="action_subtask" type="object" class="oe_stat_button" icon="fa-tasks"
attrs="{'invisible' : [('parent_id', '!=', False)]}"
context="{'project_id': project_id, 'name': name, 'parent_id': id}" groups="project.group_subtask_project">
<field string="Sub-tasks" name="subtask_count" widget="statinfo"/>
+4 -1
View File
@@ -167,7 +167,10 @@ class AccountInvoice(models.Model):
#for average/fifo/lifo costing method, fetch real cost price from incomming moves
valuation_price_unit = i_line.purchase_line_id.product_uom._compute_price(i_line.purchase_line_id.price_unit, i_line.uom_id)
stock_move_obj = self.env['stock.move']
valuation_stock_move = stock_move_obj.search([('purchase_line_id', '=', i_line.purchase_line_id.id), ('state', '=', 'done')])
valuation_stock_move = stock_move_obj.search([
('purchase_line_id', '=', i_line.purchase_line_id.id),
('state', '=', 'done'), ('product_qty', '!=', 0.0)
])
if self.type == 'in_refund':
valuation_stock_move = valuation_stock_move.filtered(lambda m: m._is_out())
elif self.type == 'in_invoice':
+1 -1
View File
@@ -182,7 +182,7 @@ class PaymentTransaction(models.Model):
'currency_id': order.pricelist_id.currency_id.id,
'partner_id': order.partner_id.id,
'partner_country_id': order.partner_id.country_id.id,
'reference': self.get_next_reference(order.name),
'reference': self._get_next_reference(order.name, acquirer=acquirer),
'sale_order_id': order.id,
}
if add_tx_values:
+1 -1
View File
@@ -1116,7 +1116,7 @@ class Binary(http.Controller):
if request.httprequest.user_agent.browser == 'safari':
# Safari sends NFD UTF-8 (where é is composed by 'e' and [accent])
# we need to send it the same stuff, otherwise it'll fail
filename = unicodedata.normalize('NFD', ufile.filename).encode('UTF-8')
filename = unicodedata.normalize('NFD', ufile.filename)
try:
attachment = Model.create({
@@ -39,7 +39,7 @@ class WebsiteEventSaleController(WebsiteEventController):
# free tickets -> order with amount = 0: auto-confirm, no checkout
if not order.amount_total:
order.action_confirm() # tde notsure: email sending ?
attendees = request.env['event.registration'].browse(list(attendee_ids))
attendees = request.env['event.registration'].browse(list(attendee_ids)).sudo()
# clean context and session, then redirect to the confirmation page
request.website.sale_reset()
return request.render("website_event.registration_complete", {
@@ -147,12 +147,22 @@ var PDFSlidesViewer = (function(){
PDFSlidesViewer.prototype.toggleFullScreenFooter = function(){
if(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) {
$('div#PDFViewer > div.navbar-fixed-bottom').toggleClass('oe_show_footer');
var $navBarFooter = $('div#PDFViewer > div.navbar-fixed-bottom');
$navBarFooter.toggleClass('oe_show_footer');
if ($navBarFooter.css('display') === 'none') {
$navBarFooter.css('display', 'block');
$('div#PDFViewer').css('padding-bottom', '50px');
} else {
$navBarFooter.css('display', 'none');
$('div#PDFViewer').css('padding-bottom', '0');
}
}
}
PDFSlidesViewer.prototype.toggleFullScreen = function(){
var el = this.canvas.parentNode;
// The canvas and the navigation bar needs to be fullscreened
var el = this.canvas.parentNode.parentNode;
var isFullscreenAvailable = document.fullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled || document.msFullscreenEnabled || false;
if(isFullscreenAvailable){ // Full screen supported