diff --git a/contract/models/account_analytic_account.py b/contract/models/account_analytic_account.py
index 4266a5aa..85d26053 100644
--- a/contract/models/account_analytic_account.py
+++ b/contract/models/account_analytic_account.py
@@ -240,7 +240,8 @@ class AccountAnalyticAccount(models.Model):
invoice = self.env['account.invoice'].create(invoice_vals)
for line in self.recurring_invoice_line_ids:
invoice_line_vals = self._prepare_invoice_line(line, invoice.id)
- self.env['account.invoice.line'].create(invoice_line_vals)
+ if invoice_line_vals:
+ self.env['account.invoice.line'].create(invoice_line_vals)
invoice.compute_taxes()
return invoice
diff --git a/contract/models/res_partner.py b/contract/models/res_partner.py
index cd9c30ce..9ba30acb 100644
--- a/contract/models/res_partner.py
+++ b/contract/models/res_partner.py
@@ -18,8 +18,7 @@ class ResPartner(models.Model):
for partner in self:
partner.contract_count = Contract.search_count([
('recurring_invoices', '=', True),
- ('partner_id', '=', partner.id),
- ('date_start', '<=', today),
+ ('partner_id', 'child_of', partner.ids),
'|',
('date_end', '=', False),
('date_end', '>=', today),
@@ -37,9 +36,10 @@ class ResPartner(models.Model):
self.env.context,
search_default_recurring_invoices=True,
search_default_not_finished=True,
+ search_default_partner_id=self.id,
default_partner_id=self.id,
default_recurring_invoices=True,
+ default_pricelist_id=self.pricelist_id.id,
),
- domain=[('partner_id', '=', self.id)],
)
return res
diff --git a/contract/views/account_analytic_account_view.xml b/contract/views/account_analytic_account_view.xml
index 1a96b0dc..b915b90b 100644
--- a/contract/views/account_analytic_account_view.xml
+++ b/contract/views/account_analytic_account_view.xml
@@ -116,12 +116,11 @@
account.analytic.account
+
+
+
-
-
-
-