diff options
| author | Thibault Francois <tfr@openerp.com> | 2020-02-17 16:36:47 +0000 |
|---|---|---|
| committer | Thibault Francois <tfr@openerp.com> | 2020-02-18 13:15:04 +0000 |
| commit | bd7b36aa5a87ed7b7e995f8e20c82da3de7dcbca (patch) | |
| tree | 3610b494773bfcde9124e27fe711a2b8890bad68 | |
| parent | a232f563121c31d7a74d5c196c7f4b665580e111 (diff) | |
[FIX] account: allow salesman to send and print posted invoice
Issue: as salesman you want to send and print the invoice of your customer
but you don't have the access to write on the invoice
and thus you don't have access to create a mail.message and
set the flag invoice_sent to True
Allow to post message on an invoice when you have read access
closes odoo/odoo#45629
X-original-commit: d23d872f885f34bbbd747471e35e6914ac79b6cf
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
| -rw-r--r-- | addons/account/models/account_move.py | 1 | ||||
| -rw-r--r-- | addons/account/wizard/account_invoice_send.py | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 4bb88b46948..c273bd35c72 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -34,6 +34,7 @@ class AccountMove(models.Model): _inherit = ['portal.mixin', 'mail.thread', 'mail.activity.mixin', 'sequence.mixin'] _description = "Journal Entries" _order = 'date desc, name desc, id desc' + _mail_post_access = 'read' @property def _sequence_monthly_regex(self): diff --git a/addons/account/wizard/account_invoice_send.py b/addons/account/wizard/account_invoice_send.py index a4e4a8802b9..7ef17afc7c1 100644 --- a/addons/account/wizard/account_invoice_send.py +++ b/addons/account/wizard/account_invoice_send.py @@ -86,7 +86,9 @@ class AccountInvoiceSend(models.TransientModel): if self.is_email: self.composer_id.send_mail() if self.env.context.get('mark_invoice_as_sent'): - self.mapped('invoice_ids').write({'invoice_sent': True}) + #Salesman send posted invoice, without the right to write + #but they should have the right to change this flag + self.mapped('invoice_ids').sudo().write({'invoice_sent': True}) def _print_document(self): """ to override for each type of models that will use this composer.""" |
