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
pull/127/head
Pedro M. Baeza 7 years ago
committed by Dave Lasley
parent
commit
f6ebe6e9c7
No known key found for this signature in database GPG Key ID: 7DDBA4BA81B934CF
  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. 2
      contract/views/account_analytic_contract_view.xml

3
contract/__manifest__.py

@ -9,7 +9,7 @@
{
'name': 'Contracts Management - Recurring',
'version': '10.0.3.1.0',
'version': '10.0.3.2.0',
'category': 'Contract Management',
'license': 'AGPL-3',
'author': "OpenERP SA, "
@ -20,6 +20,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

@ -61,15 +61,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.iteritems():
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

@ -38,6 +38,7 @@
<field name="contract_template_id" colspan="4"/>
<field name="journal_id"/>
<field name="pricelist_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<label for="recurring_interval"/>
<div>
<field name="recurring_interval"
@ -119,11 +120,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"
@ -145,7 +146,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">

2
contract/views/account_analytic_contract_view.xml

@ -7,11 +7,11 @@
<field name="arch" type="xml">
<form string="Contract Template">
<group name="group_main">
<field name="company_id" invisible="1" />
<field name="name" />
<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