summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2013-04-08 01:50:13 +0200
committerOlivier Dony <odo@openerp.com>2013-04-08 01:50:13 +0200
commit438e1c1daf5bc4eb212f78b87f277fff8e8a0ceb (patch)
treed33d3ecf532a841eb94b90e3caed4e16384adc7f /addons
parentad1650854eead5af703d535cb03d5bdf56088cde (diff)
[FIX] res.partner: Hide commercial-related fields on contacts form + autosync them from parent company
Fixes handling of accounting/invoicing-related fields on partners that are not "commercial entities" (either marked as "is_company" or parentless). The corresponding fields are also hidden from form views on these partners and replaced by a short sentence and a link to edit the "master fields" on the commercial entity. This corresponds to part B of the solution described on bug 1160365. lp bug: https://launchpad.net/bugs/1160365 fixed bzr revid: odo@openerp.com-20130407235013-j3tv4uxy46eej43i
Diffstat (limited to 'addons')
-rw-r--r--addons/account/partner.py5
-rw-r--r--addons/account/partner_view.xml7
-rw-r--r--addons/base_vat/base_vat.py3
-rw-r--r--addons/l10n_be_invoice_bba/partner.py5
-rwxr-xr-xaddons/l10n_ro/res_partner.py4
-rw-r--r--addons/product/partner.py3
-rw-r--r--addons/product/partner_view.xml5
-rw-r--r--addons/purchase/partner.py3
-rw-r--r--addons/sale_journal/sale_journal.py4
-rw-r--r--addons/sale_journal/sale_journal_view.xml2
10 files changed, 38 insertions, 3 deletions
diff --git a/addons/account/partner.py b/addons/account/partner.py
index ae8d2fc1871..4914a17dd2b 100644
--- a/addons/account/partner.py
+++ b/addons/account/partner.py
@@ -236,6 +236,11 @@ class res_partner(osv.osv):
'last_reconciliation_date': fields.datetime('Latest Full Reconciliation Date', help='Date on which the partner accounting entries were fully reconciled last time. It differs from the last date where a reconciliation has been made for this partner, as here we depict the fact that nothing more was to be reconciled at this date. This can be achieved in 2 different ways: either the last unreconciled debit/credit entry of this partner was reconciled, either the user pressed the button "Nothing more to reconcile" during the manual reconciliation process.')
}
+ def _commercial_fields(self, cr, uid, context=None):
+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + \
+ ['debit_limit', 'property_account_payable', 'property_account_receivable', 'property_account_position',
+ 'property_payment_term', 'property_supplier_payment_term', 'last_reconciliation_date']
+
res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml
index 1267e20165b..abded67f6ab 100644
--- a/addons/account/partner_view.xml
+++ b/addons/account/partner_view.xml
@@ -73,7 +73,7 @@
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="History" position="before" version="7.0">
- <page string="Accounting" col="4">
+ <page string="Accounting" col="4" name="accounting" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
<group>
<group>
<field name="property_account_position" widget="selection"/>
@@ -103,6 +103,11 @@
</tree>
</field>
</page>
+ <page string="Accounting" name="accounting_disabled" attrs="{'invisible': ['|',('is_company','=',True),('parent_id','=',False)]}">
+ <div>
+ <p>Accounting-related settings are managed on <button name="open_commercial_entity" type="object" string="the parent company" class="oe_link"/></p>
+ </div>
+ </page>
</page>
</field>
</record>
diff --git a/addons/base_vat/base_vat.py b/addons/base_vat/base_vat.py
index 616333e3b47..3366101c7c7 100644
--- a/addons/base_vat/base_vat.py
+++ b/addons/base_vat/base_vat.py
@@ -134,6 +134,9 @@ class res_partner(osv.osv):
'vat_subjected': fields.boolean('VAT Legal Statement', help="Check this box if the partner is subjected to the VAT. It will be used for the VAT legal statement.")
}
+ def _commercial_fields(self, cr, uid, context=None):
+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['vat_subjected']
+
def _construct_constraint_msg(self, cr, uid, ids, context=None):
def default_vat_check(cn, vn):
# by default, a VAT number is valid if:
diff --git a/addons/l10n_be_invoice_bba/partner.py b/addons/l10n_be_invoice_bba/partner.py
index 9e0eec10713..df68268bf43 100644
--- a/addons/l10n_be_invoice_bba/partner.py
+++ b/addons/l10n_be_invoice_bba/partner.py
@@ -44,6 +44,11 @@ class res_partner(osv.osv):
help='Select Algorithm to generate the Structured Communication on Outgoing Invoices.' ),
}
+ def _commercial_fields(self, cr, uid, context=None):
+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + \
+ ['out_inv_comm_type', 'out_inv_comm_algorithm']
+
+
_default = {
'out_inv_comm_type': 'none',
}
diff --git a/addons/l10n_ro/res_partner.py b/addons/l10n_ro/res_partner.py
index 1cfe7390a77..95867f8e883 100755
--- a/addons/l10n_ro/res_partner.py
+++ b/addons/l10n_ro/res_partner.py
@@ -32,6 +32,10 @@ class res_partner(osv.osv):
('vat_uniq', 'unique (vat)', 'The vat of the partner must be unique !'),
('nrc_uniq', 'unique (nrc)', 'The code of the partner must be unique !')
]
+
+ def _commercial_fields(self, cr, uid, context=None):
+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['nrc']
+
res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/product/partner.py b/addons/product/partner.py
index 1d11e909346..4a291a8ddd3 100644
--- a/addons/product/partner.py
+++ b/addons/product/partner.py
@@ -36,6 +36,9 @@ class res_partner(osv.osv):
help="This pricelist will be used, instead of the default one, for sales to the current partner"),
}
+ def _commercial_fields(self, cr, uid, context=None):
+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_product_pricelist']
+
res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/product/partner_view.xml b/addons/product/partner_view.xml
index acb087533ac..5117da6044e 100644
--- a/addons/product/partner_view.xml
+++ b/addons/product/partner_view.xml
@@ -8,9 +8,12 @@
<field name="arch" type="xml">
<page string="Sales &amp; Purchases" position="inside">
<group>
- <group name="pricelists" groups="product.group_sale_pricelist">
+ <group name="pricelists" groups="product.group_sale_pricelist" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
<field name="property_product_pricelist"/>
</group>
+ <div name="parent_pricelists" groups="product.group_sale_pricelist" attrs="{'invisible': ['|',('is_company','=',True),('parent_id','=',False)]}">
+ <p>Pricelists are managed on <button name="open_commercial_entity" type="object" string="the parent company" class="oe_link"/></p>
+ </div>
</group>
</page>
</field>
diff --git a/addons/purchase/partner.py b/addons/purchase/partner.py
index 56eaf288fe6..e05f6b9c9c6 100644
--- a/addons/purchase/partner.py
+++ b/addons/purchase/partner.py
@@ -43,6 +43,9 @@ class res_partner(osv.osv):
super(res_partner, self).copy(cr, uid, id, default=default, context=context)
+ def _commercial_fields(self, cr, uid, context=None):
+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_product_pricelist_purchase']
+
_columns = {
'property_product_pricelist_purchase': fields.property(
'product.pricelist',
diff --git a/addons/sale_journal/sale_journal.py b/addons/sale_journal/sale_journal.py
index 8463ab3f3bd..cb33d7e2334 100644
--- a/addons/sale_journal/sale_journal.py
+++ b/addons/sale_journal/sale_journal.py
@@ -52,6 +52,10 @@ class res_partner(osv.osv):
group_name = "Accounting Properties",
help = "This invoicing type will be used, by default, to invoice the current partner."),
}
+
+ def _commercial_fields(self, cr, uid, context=None):
+ return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_invoice_type']
+
res_partner()
class picking(osv.osv):
diff --git a/addons/sale_journal/sale_journal_view.xml b/addons/sale_journal/sale_journal_view.xml
index bcd83b5be84..9d41103252e 100644
--- a/addons/sale_journal/sale_journal_view.xml
+++ b/addons/sale_journal/sale_journal_view.xml
@@ -146,7 +146,7 @@
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Sales &amp; Purchases" position="inside">
- <group colspan="2" col="2">
+ <group colspan="2" col="2" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}">
<separator string="Invoicing" colspan="2"/>
<field name="property_invoice_type"/>
</group>