diff --git a/contract/__manifest__.py b/contract/__manifest__.py
index 70ff7890..ff9e4260 100644
--- a/contract/__manifest__.py
+++ b/contract/__manifest__.py
@@ -9,7 +9,7 @@
{
'name': 'Contracts Management - Recurring',
- 'version': '10.0.4.3.0',
+ 'version': '10.0.4.3.2',
'category': 'Contract Management',
'license': 'AGPL-3',
'author': "OpenERP SA, "
diff --git a/contract/models/account_analytic_contract.py b/contract/models/account_analytic_contract.py
index 6f04a9e5..3a1f9060 100644
--- a/contract/models/account_analytic_contract.py
+++ b/contract/models/account_analytic_contract.py
@@ -80,4 +80,5 @@ class AccountAnalyticContract(models.Model):
domain = [
('type', '=', 'sale'),
('company_id', '=', company_id)]
- return self.env['account.journal'].search(domain, limit=1)
+ return self.env['account.journal'].search(
+ domain, order='sequence asc', limit=1)
diff --git a/contract_show_invoice/__manifest__.py b/contract_show_invoice/__manifest__.py
index e83890a0..77322f00 100644
--- a/contract_show_invoice/__manifest__.py
+++ b/contract_show_invoice/__manifest__.py
@@ -6,7 +6,7 @@
{
'name': 'Contract Show Invoice',
'summary': 'Button in contracts to show their invoices',
- 'version': '10.0.1.0.1',
+ 'version': '10.0.1.0.2',
'license': 'AGPL-3',
'author': 'Domatix,'
'Tecnativa,'
diff --git a/contract_show_invoice/models/account_analytic_account.py b/contract_show_invoice/models/account_analytic_account.py
index 2ec2bad6..699e61e0 100644
--- a/contract_show_invoice/models/account_analytic_account.py
+++ b/contract_show_invoice/models/account_analytic_account.py
@@ -10,13 +10,15 @@ class AccountAnalyticAccount(models.Model):
@api.multi
def _compute_total_invoiced(self):
- invoice_model = self.env['account.invoice']
+ invoice_line_model = self.env['account.invoice.line']
for analytic in self:
- fetch_data = invoice_model.read_group(
- [('invoice_line_ids.account_analytic_id', '=', analytic.id)],
- ['amount_total'], [],
+ fetch_data = invoice_line_model.read_group(
+ [('account_analytic_id', '=', analytic.id),
+ ('invoice_id.state', 'in', ['open', 'paid']),
+ ('invoice_id.type', 'in', ['out_invoice', 'out_refund'])],
+ ['price_subtotal_signed'], [],
)
- analytic.total_invoiced = fetch_data[0]['amount_total']
+ analytic.total_invoiced = fetch_data[0]['price_subtotal_signed']
total_invoiced = fields.Float(string="Total Invoiced",
compute='_compute_total_invoiced')
diff --git a/contract_show_invoice/views/contract_view.xml b/contract_show_invoice/views/contract_view.xml
index 590e068e..5f26972d 100644
--- a/contract_show_invoice/views/contract_view.xml
+++ b/contract_show_invoice/views/contract_view.xml
@@ -6,7 +6,7 @@
[active_id], 'default_analytic_account_ids': [active_id]}
Invoices
account.invoice
- [('analytic_account_ids','=',active_id)]
+ [('analytic_account_ids','=',active_id), ('type','in', ['out_invoice', 'out_refund']), ('state', 'not in', ['draft', 'cancel'])]
@@ -24,6 +24,17 @@
+
+ account.invoice.tree.show.total.untaxed
+ account.invoice
+
+
+
+
+
+
+
+
account.analytic.account.button.invoice