Browse Source

[FIX] Errors in navigation to customer invoices / vendor bills

13.0-mig-contract
Jordi Ballester Alomar 6 years ago
committed by Administrator
parent
commit
9ede21d31e
  1. 10
      contract/models/account_analytic_account.py
  2. 9
      contract/views/account_analytic_account_view.xml
  3. 15
      contract/views/account_invoice_view.xml
  4. 6
      contract/views/res_partner_view.xml

10
contract/models/account_analytic_account.py

@ -349,3 +349,13 @@ class AccountAnalyticAccount(models.Model):
'target': 'new', 'target': 'new',
'context': ctx, 'context': ctx,
} }
@api.multi
def button_show_recurring_invoices(self):
self.ensure_one()
action = self.env.ref(
'contract.act_purchase_recurring_invoices')
if self.contract_type == 'sale':
action = self.env.ref(
'contract.act_recurring_invoices')
return action.read()[0]

9
contract/views/account_analytic_account_view.xml

@ -34,8 +34,8 @@
class="oe_link" class="oe_link"
groups="base.group_no_one" groups="base.group_no_one"
/> />
<button name="contract.act_recurring_invoices"
type="action"
<button name="button_show_recurring_invoices"
type="object"
attrs="{'invisible': [('recurring_invoices','!=',True)]}" attrs="{'invisible': [('recurring_invoices','!=',True)]}"
string="⇒ Show recurring invoices" string="⇒ Show recurring invoices"
class="oe_link" class="oe_link"
@ -44,6 +44,7 @@
<group col="4" attrs="{'invisible': [('recurring_invoices','!=',True)]}"> <group col="4" attrs="{'invisible': [('recurring_invoices','!=',True)]}">
<field name="contract_template_id" colspan="4" domain="['|', ('contract_type', '=', contract_type), ('contract_type', '=', False)]" context="{'default_contract_type': contract_type}"/> <field name="contract_template_id" colspan="4" domain="['|', ('contract_type', '=', contract_type), ('contract_type', '=', False)]" context="{'default_contract_type': contract_type}"/>
<field name="journal_id" <field name="journal_id"
domain="[('type', '=', contract_type),('company_id', '=', company_id)]"
attrs="{'required': [('recurring_invoices', '=', True)]}" attrs="{'required': [('recurring_invoices', '=', True)]}"
/> />
<field name="pricelist_id"/> <field name="pricelist_id"/>
@ -111,7 +112,7 @@
<attribute name="context">{'default_customer': True, 'default_supplier': False}</attribute> <attribute name="context">{'default_customer': True, 'default_supplier': False}</attribute>
</field> </field>
<field name="journal_id" position="attributes"> <field name="journal_id" position="attributes">
<attribute name="domain">[('type', '=', 'sale')]</attribute>
<attribute name="domain">[('type', '=', 'sale'),('company_id', '=', company_id)]</attribute>
</field> </field>
<field name="product_id" position="attributes"> <field name="product_id" position="attributes">
<attribute name="domain">[('sale_ok', '=', True)]</attribute> <attribute name="domain">[('sale_ok', '=', True)]</attribute>
@ -132,7 +133,7 @@
<attribute name="context">{'default_customer': False, 'default_supplier': True}</attribute> <attribute name="context">{'default_customer': False, 'default_supplier': True}</attribute>
</field> </field>
<field name="journal_id" position="attributes"> <field name="journal_id" position="attributes">
<attribute name="domain">[('type', '=', 'purchase')]</attribute>
<attribute name="domain">[('type', '=', 'purchase'),('company_id', '=', company_id)]</attribute>
</field> </field>
<field name="product_id" position="attributes"> <field name="product_id" position="attributes">
<attribute name="domain">[('purchase_ok', '=', True)]</attribute> <attribute name="domain">[('purchase_ok', '=', True)]</attribute>

15
contract/views/account_invoice_view.xml

@ -24,6 +24,21 @@
'search_default_contract_id': [active_id], 'search_default_contract_id': [active_id],
'default_contract_id': active_id} 'default_contract_id': active_id}
</field> </field>
<field name="domain">[('type','in', ['out_invoice', 'out_refund'])]</field>
</record>
<record id="act_purchase_recurring_invoices" model="ir.actions.act_window">
<field name="name">Vendor Bills</field>
<field name="res_model">account.invoice</field>
<field name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('account.invoice_supplier_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('account.invoice_supplier_form')})]"/>
<field name="context">{
'search_default_contract_id': [active_id],
'default_contract_id': active_id}
</field>
<field name="domain">[('type','in', ['in_invoice', 'in_refund'])]</field>
</record> </record>
</odoo> </odoo>

6
contract/views/res_partner_view.xml

@ -9,12 +9,14 @@
<field type="xml" name="arch"> <field type="xml" name="arch">
<xpath expr="//div[@name='button_box']" position="inside"> <xpath expr="//div[@name='button_box']" position="inside">
<button name="act_show_contract" type="object" class="oe_stat_button" <button name="act_show_contract" type="object" class="oe_stat_button"
icon="fa-book" context="{'contract_type': 'sale'}"
icon="fa-book" context="{'default_contract_type': 'sale', 'contract_type': 'sale'}"
attrs="{'invisible': [('customer','=',False)]}"
help="Show the sale contracts for this partner"> help="Show the sale contracts for this partner">
<field name="sale_contract_count" widget="statinfo" string="Sale Contracts"/> <field name="sale_contract_count" widget="statinfo" string="Sale Contracts"/>
</button> </button>
<button name="act_show_contract" type="object" class="oe_stat_button" <button name="act_show_contract" type="object" class="oe_stat_button"
icon="fa-book" context="{'contract_type': 'purchase'}"
icon="fa-book" context="{'default_contract_type': 'purchase', 'contract_type': 'purchase'}"
attrs="{'invisible': [('supplier','=',False)]}"
help="Show the purchase contracts for this partner"> help="Show the purchase contracts for this partner">
<field name="purchase_contract_count" widget="statinfo" string="Purchase Contracts"/> <field name="purchase_contract_count" widget="statinfo" string="Purchase Contracts"/>
</button> </button>

Loading…
Cancel
Save