diff --git a/contract/__manifest__.py b/contract/__manifest__.py index 60831f92..d2444b79 100644 --- a/contract/__manifest__.py +++ b/contract/__manifest__.py @@ -8,7 +8,7 @@ { 'name': 'Contracts Management - Recurring', - 'version': '11.0.1.2.0', + 'version': '11.0.1.3.0', 'category': 'Contract Management', 'license': 'AGPL-3', 'author': "OpenERP SA, " @@ -19,6 +19,7 @@ 'depends': ['base', 'account', 'analytic'], 'data': [ 'security/ir.model.access.csv', + 'security/contract_security.xml', 'report/report_contract.xml', 'report/contract_views.xml', 'data/contract_cron.xml', diff --git a/contract/models/account_analytic_account.py b/contract/models/account_analytic_account.py index 1e1a1db3..05b2182b 100644 --- a/contract/models/account_analytic_account.py +++ b/contract/models/account_analytic_account.py @@ -71,15 +71,13 @@ class AccountAnalyticAccount(models.Model): deletion ensures that any errant lines that are created are also deleted. """ - contract = self.contract_template_id - + if not contract: + return for field_name, field in contract._fields.items(): - if field.name == 'recurring_invoice_line_ids': lines = self._convert_contract_lines(contract) self.recurring_invoice_line_ids = lines - elif not any(( field.compute, field.related, field.automatic, field.readonly, field.company_dependent, diff --git a/contract/security/contract_security.xml b/contract/security/contract_security.xml new file mode 100644 index 00000000..3884e6ef --- /dev/null +++ b/contract/security/contract_security.xml @@ -0,0 +1,10 @@ + + + + Contract template multi-company + + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + + diff --git a/contract/views/account_analytic_account_view.xml b/contract/views/account_analytic_account_view.xml index 1d268041..1a96b0dc 100644 --- a/contract/views/account_analytic_account_view.xml +++ b/contract/views/account_analytic_account_view.xml @@ -44,6 +44,7 @@ attrs="{'required': [('recurring_invoices', '=', True)]}" /> +