diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 0f532a2afdcd71353b85996617906d12124591bf..197ef0a8b3705ba80b2f125a298190fb47810fb0 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -1054,6 +1054,7 @@ class AccountJournal(models.Model): 'res_model': 'account.move', 'views': [[False, "tree"], [False, "form"]], 'type': 'ir.actions.act_window', + 'context': self._context } if len(invoices) == 1: action_vals.update({'res_id': invoices[0].id, 'view_mode': 'form'}) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 21a206f0da9fc4fe684277b2b9e56b2429987ae9..afeb9c6c42c48e3df75671d44196158d434ae370 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -40,6 +40,7 @@ class account_journal(models.Model): act_type.name as act_type_name, act_type.category as activity_category, act.date_deadline, + m.date, CASE WHEN act.date_deadline < CURRENT_DATE THEN 'late' ELSE 'future' END as status FROM account_move m LEFT JOIN mail_activity act ON act.res_id = m.id @@ -54,7 +55,7 @@ class account_journal(models.Model): 'res_id': activity.get('res_id'), 'res_model': activity.get('res_model'), 'status': activity.get('status'), - 'name': activity.get('summary') or activity.get('act_type_name'), + 'name': (activity.get('summary') or activity.get('act_type_name')) + '(' + format_date(activity.get('date'), 'MMM', locale=self._context.get('lang') or 'en_US') + ')', 'activity_category': activity.get('activity_category'), 'date': odoo_format_date(self.env, activity.get('date_deadline')) }) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 76e90e3ccebf4ab22111c0ed6c77200f9c5ae44a..c292b0bbc1fba83eb5f1465b9e813f344f598a83 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2194,14 +2194,14 @@ class AccountMoveLine(models.Model): tax_group_id = fields.Many2one(related='tax_line_id.tax_group_id', string='Originator tax group', readonly=True, store=True, help='technical field for widget tax-group-custom-field') - tax_base_amount = fields.Monetary(string="Base Amount", store=True, + tax_base_amount = fields.Monetary(string="Base Amount", store=True, readonly=True, currency_field='company_currency_id') - tax_exigible = fields.Boolean(string='Appears in VAT report', default=True, + tax_exigible = fields.Boolean(string='Appears in VAT report', default=True, readonly=True, help="Technical field used to mark a tax line as exigible in the vat report or not (only exigible journal items" " are displayed). By default all new journal items are directly exigible, but with the feature cash_basis" " on taxes, some will become exigible only when the payment is recorded.") tax_repartition_line_id = fields.Many2one(comodel_name='account.tax.repartition.line', - string="Originator Tax Repartition Line", ondelete='restrict', + string="Originator Tax Repartition Line", ondelete='restrict', readonly=True, help="Tax repartition line that caused the creation of this move line, if any") tag_ids = fields.Many2many(string="Tags", comodel_name='account.account.tag', ondelete='restrict', help="Tags assigned to this line by the tax creating it, if any. It determines its impact on financial reports.") diff --git a/addons/account/static/src/js/bills_tree_upload.js b/addons/account/static/src/js/bills_tree_upload.js index 2287ca09d7c3f7dd4bb6d65359596a2c3d646c87..3e36b495e1a9bc0a42d6329df63e29b3d11f0eef 100644 --- a/addons/account/static/src/js/bills_tree_upload.js +++ b/addons/account/static/src/js/bills_tree_upload.js @@ -99,6 +99,22 @@ odoo.define('account.dashboard.kanban', function (require) { 'click .o_button_upload_bill': '_onUpload', 'change .o_vendor_bill_upload .o_form_binary_form': '_onAddAttachment', }), + /** + * We override _onUpload (from the upload bill mixin) to pass default_journal_id + * and default_type in context. + * + * @override + */ + _onUpload: function (event) { + var kanbanRecord = $(event.currentTarget).closest('.o_kanban_record').data('record'); + this.initialState.context['default_journal_id'] = kanbanRecord.id; + if ($(event.currentTarget).attr('journal_type') == 'sale') { + this.initialState.context['default_type'] = 'out_invoice' + } else if ($(event.currentTarget).attr('journal_type') == 'purchase') { + this.initialState.context['default_type'] = 'in_invoice' + } + UploadBillMixin._onUpload.apply(this, arguments); + } }); var DashboardKanbanView = KanbanView.extend({ diff --git a/addons/account/views/account_journal_dashboard_view.xml b/addons/account/views/account_journal_dashboard_view.xml index 7f0793e469e962dbe57b1e92d1efc6f848ff8f9e..6948039af5d1e7eeef0ccd7cb2f58790f434e41c 100644 --- a/addons/account/views/account_journal_dashboard_view.xml +++ b/addons/account/views/account_journal_dashboard_view.xml @@ -294,9 +294,15 @@ <button type="object" name="action_create_new" class="btn btn-primary o_invoice_new"> <span>New Invoice</span> </button> + <button class="btn btn-primary d-block o_button_upload_bill" journal_type="sale"> + <span>Upload Invoices</span> + </button> </t> <t t-if="journal_type == 'purchase'"> - <button class="btn btn-primary o_button_upload_bill" journal_type="purchase"> + <button type="object" name="action_create_new" class="btn btn-primary o_invoice_new"> + <span>New Bill</span> + </button> + <button class="btn btn-primary d-block o_button_upload_bill" journal_type="purchase"> <span>Upload Bills</span> </button> </t> diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 81febe7ccd50d339b83ea7bfaa55fe1b3d88328a..bd0cbd95093bf24494d74f6762124c56f9670adf 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -809,9 +809,9 @@ <field name="date" invisible="1"/> <field name="tax_line_id" invisible="1"/> <field name="tax_group_id" invisible="1"/> - <field name="tax_repartition_line_id" invisible="1"/> - <field name="tax_base_amount" invisible="1"/> - <field name="tax_exigible" invisible="1"/> + <field name="tax_repartition_line_id" invisible="1" force_save="1"/> + <field name="tax_base_amount" invisible="1" force_save="1"/> + <field name="tax_exigible" invisible="1" force_save="1"/> <field name="company_id" invisible="1"/> <field name="company_currency_id" invisible="1"/> <field name="recompute_tax_line" invisible="1" force_save="1"/>