[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
This commit is contained in:
parent
ad1650854e
commit
438e1c1daf
|
@ -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:
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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',
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
<field name="arch" type="xml">
|
||||
<page string="Sales & 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>
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<page string="Sales & 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>
|
||||
|
|
Loading…
Reference in New Issue