Browse Source

[FIX+IMP] contract: Real fix to company_id missing + improvements

* company_id was empty because an onchange, not inheritance nor visibility
* Added multi-company group to company_id fields
* Added multi-company access rule to contract templates
* Fix double %% in XML dates that was causing an error
* When creating a contract, recurring_invoices is set by default
13.0-mig-contract
Pedro M. Baeza 7 years ago
committed by Administrator
parent
commit
47c2b644dc
  1. 3
      contract/__manifest__.py
  2. 6
      contract/models/account_analytic_account.py
  3. 10
      contract/security/contract_security.xml
  4. 7
      contract/views/account_analytic_account_view.xml
  5. 1
      contract/views/account_analytic_contract_view.xml

3
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',

6
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,

10
contract/security/contract_security.xml

@ -0,0 +1,10 @@
<odoo noupdate="1">
<record id="rule_contract_template_multi_company" model="ir.rule">
<field name="name">Contract template multi-company</field>
<field name="model_id" ref="model_account_analytic_contract"/>
<field name="global" eval="True"/>
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
</record>
</odoo>

7
contract/views/account_analytic_account_view.xml

@ -44,6 +44,7 @@
attrs="{'required': [('recurring_invoices', '=', True)]}"
/>
<field name="pricelist_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<label for="recurring_interval"/>
<div>
<field name="recurring_interval"
@ -131,11 +132,11 @@
<separator/>
<filter name="not_finished"
string="Valid"
domain="['|', ('date_end', '=', False), ('date_end', '&gt;=', time.strftime('%%Y-%%m-%%d'))]"
domain="['|', ('date_end', '=', False), ('date_end', '&gt;=', time.strftime('%Y-%m-%d'))]"
/>
<filter name="finished"
string="Finished"
domain="[('date_end', '&lt;', time.strftime('%%Y-%%m-%%d'))]"
domain="[('date_end', '&lt;', time.strftime('%Y-%m-%d'))]"
/>
<group expand="0" string="Group By...">
<filter string="Next Invoice"
@ -157,7 +158,7 @@
<field name="res_model">account.analytic.account</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'is_contract':1, 'search_default_not_finished':1, 'search_default_recurring_invoices':1}</field>
<field name="context">{'is_contract':1, 'search_default_not_finished':1, 'search_default_recurring_invoices':1, 'default_recurring_invoices': 1}</field>
<field name="search_view_id" ref="analytic.view_account_analytic_account_search"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">

1
contract/views/account_analytic_contract_view.xml

@ -12,6 +12,7 @@
<group name="group_main_left">
<field name="journal_id" />
<field name="pricelist_id" />
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group name="group_main_right">
<field name="recurring_invoicing_type" />

Loading…
Cancel
Save