diff --git a/addons/account/data/invoice_action_data.xml b/addons/account/data/invoice_action_data.xml
index d55627d69e1..41d8dea7d6f 100644
--- a/addons/account/data/invoice_action_data.xml
+++ b/addons/account/data/invoice_action_data.xml
@@ -19,6 +19,7 @@
% set access_action = object.get_access_action()
% set access_name = 'View invoice' if access_action and access_action['type'] == 'ir.actions.act_url' else 'See invoice'
% set access_url = access_action['type'] == 'ir.actions.act_url' and access_action['url'] or '/report/pdf/account.report_invoice/' + str(object.id)
+% set is_online = access_action and access_action['type'] == 'ir.actions.act_url'
Dear
% if object.partner_id.is_company and object.child_ids:
@@ -35,9 +36,12 @@ amounting in ${object.amount_total} ${object.currency_id.name}
from ${object.company_id.name}.
+% if is_inline:
${access_name}
+% endif
+
If you have any question, do not hesitate to contact us.
Best regards,
]]>
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py
index eaec3b34422..8ddfdfe1107 100644
--- a/addons/account/models/account_invoice.py
+++ b/addons/account/models/account_invoice.py
@@ -1069,6 +1069,8 @@ class AccountInvoice(models.Model):
continue
if not recipient.user_ids:
group_data['partner'] |= recipient
+ elif all(recipient.user_ids.mapped('share')):
+ group_data['partner'] |= recipient
else:
group_data['user'] |= recipient
done_ids.add(recipient.id)
diff --git a/addons/portal_sale/__openerp__.py b/addons/portal_sale/__openerp__.py
index 828a41cb232..1095b637c22 100644
--- a/addons/portal_sale/__openerp__.py
+++ b/addons/portal_sale/__openerp__.py
@@ -28,7 +28,6 @@ by default, you simply need to configure a Paypal account in the Accounting/Invo
'depends': ['sale', 'portal', 'payment'],
'data': [
'security/portal_sale_security.xml',
- 'security/ir.model.access.csv',
'views/sale_order_views.xml',
],
'auto_install': True,
diff --git a/addons/portal_sale/models/account_invoice.py b/addons/portal_sale/models/account_invoice.py
index 75de697483e..628d79d27d3 100644
--- a/addons/portal_sale/models/account_invoice.py
+++ b/addons/portal_sale/models/account_invoice.py
@@ -22,12 +22,3 @@ class AccountInvoice(models.Model):
action='/mail/view',
model=self._name,
res_id=self.id)[self.partner_id.id]
-
- @api.multi
- def get_formview_action(self):
- # NOTE : if this method is call as sudo, the only to determine if the user is portal is to check the uid from context
- # This was introduced with https://github.com/odoo/odoo/commit/f5fedbcb18a57ee9aeab952f3ff95f692f7a863c, and should be better fixed.
- uid = self.env.context.get('uid', self.env.user.id)
- if self.env['res.users'].sudo().browse(uid).share:
- return self.env['ir.actions.act_window'].for_xml_id('portal_sale', 'portal_action_invoices')
- return super(AccountInvoice, self).get_formview_action()
diff --git a/addons/portal_sale/models/sale_order.py b/addons/portal_sale/models/sale_order.py
index f3dc5444d4c..b11d000c125 100644
--- a/addons/portal_sale/models/sale_order.py
+++ b/addons/portal_sale/models/sale_order.py
@@ -22,13 +22,3 @@ class SaleOrder(models.Model):
action='/mail/view',
model=self._name,
res_id=self.id)[self.partner_id.id]
-
- @api.multi
- def get_formview_action(self):
- # NOTE : if this method is call as sudo, the only to determine if the user is portal is to check the uid from context
- # This was introduced with https://github.com/odoo/odoo/commit/f5fedbcb18a57ee9aeab952f3ff95f692f7a863c, and should be better fixed.
- uid = self.env.context.get('uid', self.env.user.id)
- if self.env['res.users'].sudo().browse(uid).share:
- action_xmlid = 'action_quotations_portal' if self.state in ('draft', 'sent') else 'action_orders_portal'
- return self.env['ir.actions.act_window'].for_xml_id('portal_sale', action_xmlid)
- return super(SaleOrder, self).get_formview_action()
diff --git a/addons/project_issue/models/project_issue.py b/addons/project_issue/models/project_issue.py
index 8d4dacd0caf..ebfa3377e4b 100644
--- a/addons/project_issue/models/project_issue.py
+++ b/addons/project_issue/models/project_issue.py
@@ -259,6 +259,8 @@ class ProjectIssue(models.Model):
group_data['group_project_user'] |= recipient
elif not recipient.user_ids:
group_data['partner'] |= recipient
+ elif all(recipient.user_ids.mapped('share')):
+ group_data['partner'] |= recipient
else:
group_data['user'] |= recipient
done_ids.add(recipient.id)
diff --git a/addons/sale/data/mail_template_data.xml b/addons/sale/data/mail_template_data.xml
index d9456f28a0a..824aaa3ff84 100644
--- a/addons/sale/data/mail_template_data.xml
+++ b/addons/sale/data/mail_template_data.xml
@@ -36,9 +36,11 @@ amounting in ${object.amount_total} ${object.pricelist_id.currency_id.na
from ${object.company_id.name}.
+% if is_online:
${access_name}
+% endif
If you have any question, do not hesitate to contact us.
Best regards,
]]>
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index d5b508c8d40..cc88d62c6bc 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -487,12 +487,13 @@ class SaleOrder(models.Model):
@api.multi
def _notification_group_recipients(self, message, recipients, done_ids, group_data):
- group_user = self.env.ref('base.group_user')
for recipient in recipients:
if recipient.id in done_ids:
continue
if not recipient.user_ids:
group_data['partner'] |= recipient
+ elif all(recipient.user_ids.mapped('share')):
+ group_data['partner'] |= recipient
else:
group_data['user'] |= recipient
done_ids.add(recipient.id)
diff --git a/addons/website_portal_sale/__openerp__.py b/addons/website_portal_sale/__openerp__.py
index efd132e5bc8..673d1601858 100644
--- a/addons/website_portal_sale/__openerp__.py
+++ b/addons/website_portal_sale/__openerp__.py
@@ -13,6 +13,7 @@ Add your sales document in the frontend portal. Your customers will be able to c
],
'data': [
'views/templates.xml',
+ 'security/ir.model.access.csv',
],
'demo': [
'data/demo.xml'
diff --git a/addons/portal_sale/security/ir.model.access.csv b/addons/website_portal_sale/security/ir.model.access.csv
similarity index 100%
rename from addons/portal_sale/security/ir.model.access.csv
rename to addons/website_portal_sale/security/ir.model.access.csv
diff --git a/addons/website_portal_sale/views/templates.xml b/addons/website_portal_sale/views/templates.xml
index de449b76de8..000ce6c416d 100644
--- a/addons/website_portal_sale/views/templates.xml
+++ b/addons/website_portal_sale/views/templates.xml
@@ -381,19 +381,4 @@
-
-
- Access the complete Sale application
-
-
-
-
-
-
- If you wish to access the complete application to manage your orders, you can follow
- this link.
-
-
-
-
diff --git a/addons/website_project/__init__.py b/addons/website_project/__init__.py
index bf7fb7b45c1..805c516d376 100644
--- a/addons/website_project/__init__.py
+++ b/addons/website_project/__init__.py
@@ -2,3 +2,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import controllers
+import models
\ No newline at end of file
diff --git a/addons/website_project/models/__init__.py b/addons/website_project/models/__init__.py
new file mode 100644
index 00000000000..f08438b04dc
--- /dev/null
+++ b/addons/website_project/models/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+import project
diff --git a/addons/website_project/models/project.py b/addons/website_project/models/project.py
new file mode 100644
index 00000000000..d9a0ae1d0a4
--- /dev/null
+++ b/addons/website_project/models/project.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import api, models
+
+class Project(models.Model):
+ _inherit = ['project.project']
+
+ @api.multi
+ def get_access_action(self):
+ """ Override method that generated the link to access the document. Instead
+ of the classic form view, redirect to the post on the website directly """
+ self.ensure_one()
+ return {
+ 'type': 'ir.actions.act_url',
+ 'url': '/my/project/%s' % self.id,
+ 'target': 'self',
+ 'res_id': self.id,
+ }
+
+ @api.multi
+ def _notification_group_recipients(self, message, recipients, done_ids, group_data):
+ """ Override the method to place the portal customers in the 'user' group data as a portal view now exists"""
+ for recipient in recipients:
+ if recipient.id in done_ids:
+ continue
+ if recipient.user_ids and all(recipient.user_ids.mapped('share')):
+ group_data['user'] |= recipient
+ done_ids.add(recipient.id)
+ return super(Project, self)._notification_group_recipients(message, recipients, done_ids, group_data)
+
+
+class Task(models.Model):
+ _inherit = ['project.task']
+
+ @api.multi
+ def get_access_action(self):
+ """ Override method that generated the link to access the document. Instead
+ of the classic form view, redirect to the post on the website directly """
+ self.ensure_one()
+ return {
+ 'type': 'ir.actions.act_url',
+ 'url': '/my/task/%s' % self.id,
+ 'target': 'self',
+ 'res_id': self.id,
+ }
+
+ @api.multi
+ def _notification_group_recipients(self, message, recipients, done_ids, group_data):
+ """ Override the method to place the portal customers in the 'user' group data as a portal view now exists"""
+ for recipient in recipients:
+ if recipient.id in done_ids:
+ continue
+ if recipient.user_ids and all(recipient.user_ids.mapped('share')):
+ group_data['user'] |= recipient
+ done_ids.add(recipient.id)
+ return super(Task, self)._notification_group_recipients(message, recipients, done_ids, group_data)
+
diff --git a/addons/website_project_issue/models/project_issue.py b/addons/website_project_issue/models/project_issue.py
index a3dd4170826..c47f1edc26a 100644
--- a/addons/website_project_issue/models/project_issue.py
+++ b/addons/website_project_issue/models/project_issue.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from openerp import _, api, models
+from openerp import api, models
class Issue(models.Model):
@@ -19,3 +19,19 @@ class Issue(models.Model):
'target': 'self',
'res_id': self.id,
}
+
+ @api.multi
+ def _notification_group_recipients(self, message, recipients, done_ids, group_data):
+ """ Override the mail.thread method to handle project users and officers
+ recipients. Indeed those will have specific action in their notification
+ emails: creating tasks, assigning it. """
+ group_project_user_id = self.env.ref('project.group_project_user').id
+ for recipient in recipients:
+ if recipient.id in done_ids:
+ continue
+ if recipient.user_ids and group_project_user_id in recipient.user_ids[0].groups_id.ids:
+ group_data['group_project_user'] |= recipient
+ elif recipient.user_ids and all(recipient.user_ids.mapped('share')):
+ group_data['user'] |= recipient
+ done_ids.add(recipient.id)
+ return super(Issue, self)._notification_group_recipients(message, recipients, done_ids, group_data)
diff --git a/addons/website_sale/models/__init__.py b/addons/website_sale/models/__init__.py
index a40ad2379a6..3f8dbc63ee7 100644
--- a/addons/website_sale/models/__init__.py
+++ b/addons/website_sale/models/__init__.py
@@ -1,3 +1,4 @@
+import account_invoice
import ir_http
import rating
import product
diff --git a/addons/website_sale/models/account_invoice.py b/addons/website_sale/models/account_invoice.py
new file mode 100644
index 00000000000..83fc8f1393a
--- /dev/null
+++ b/addons/website_sale/models/account_invoice.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import api, models
+
+
+class AccountInvoice(models.Model):
+ _inherit = 'account.invoice'
+
+ @api.multi
+ def _notification_group_recipients(self, message, recipients, done_ids, group_data):
+ """ Override the method to place the portal customers in the 'user' group data as a portal view now exists"""
+ for recipient in recipients:
+ if recipient.id in done_ids:
+ continue
+ if recipient.user_ids and all(recipient.user_ids.mapped('share')):
+ group_data['user'] |= recipient
+ done_ids.add(recipient.id)
+ return super(AccountInvoice, self)._notification_group_recipients(message, recipients, done_ids, group_data)
+
+ @api.multi
+ def get_access_action(self):
+ """ Override method that generated the link to access the document. Instead
+ of the classic form view, redirect to the online invoice if exists. """
+ self.ensure_one()
+ return {
+ 'type': 'ir.actions.act_url',
+ 'url': '/my/invoices', # No controller /my/invoices/, only a report pdf
+ 'target': 'self',
+ 'res_id': self.id,
+ }
diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py
index 4d58c5c88d3..9271a1db96b 100644
--- a/addons/website_sale/models/sale_order.py
+++ b/addons/website_sale/models/sale_order.py
@@ -123,6 +123,17 @@ class SaleOrder(models.Model):
accessory_products -= order.website_order_line.mapped('product_id')
return random.sample(accessory_products, min(len(accessory_products), 3))
+ @api.multi
+ def _notification_group_recipients(self, message, recipients, done_ids, group_data):
+ """ Override the method to place the portal customers in the 'user' group data as a portal view now exists"""
+ for recipient in recipients:
+ if recipient.id in done_ids:
+ continue
+ if recipient.user_ids and all(recipient.user_ids.mapped('share')):
+ group_data['user'] |= recipient
+ done_ids.add(recipient.id)
+ return super(SaleOrder, self)._notification_group_recipients(message, recipients, done_ids, group_data)
+
class Website(models.Model):
_inherit = 'website'