summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHetashree Chauhan <hch@odoo.com>2019-08-19 09:44:21 +0000
committerRavi Gohil <rgo@odoo.com>2019-09-06 07:12:06 +0000
commit4a1bbbff75dde3ef0f69e30efeed23cd5be268d0 (patch)
tree48ee2565dc47837f3825e92f094b8e2cf3d38918
parent36757cde6d00a9e9059ce0bfb73d768c26743ab8 (diff)
[IMP] account: various improvements
- show period along with 'Tax Report' activity of journals on accounting dashboard. - added 'Upload Invoices' button on sales journals in Accounting Dashboard. - added 'New Bill' button on purchase journals in Accounting Dashboard. Task: 34740 Closes: #34740 Co-authored-by: Hardik Prajapati <hpr@odoo.com>
-rw-r--r--addons/account/models/account.py1
-rw-r--r--addons/account/models/account_journal_dashboard.py3
-rw-r--r--addons/account/models/account_move.py6
-rw-r--r--addons/account/static/src/js/bills_tree_upload.js16
-rw-r--r--addons/account/views/account_journal_dashboard_view.xml8
-rw-r--r--addons/account/views/account_move_views.xml6
6 files changed, 32 insertions, 8 deletions
diff --git a/addons/account/models/account.py b/addons/account/models/account.py
index 0f532a2afdc..197ef0a8b37 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 21a206f0da9..afeb9c6c42c 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 76e90e3cceb..c292b0bbc1f 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 2287ca09d7c..3e36b495e1a 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 7f0793e469e..6948039af5d 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 81febe7ccd5..bd0cbd95093 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"/>