[IMP] Improve sales team invoice.
bzr revid: vba@tinyerp.com-20121120133940-dnu83uuxqkqg1tto
This commit is contained in:
parent
d9d127403b
commit
76376ed19c
|
@ -46,4 +46,37 @@ class sale_order(osv.osv):
|
|||
|
||||
sale_order()
|
||||
|
||||
|
||||
class account_invoice(osv.osv):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
_columns = {
|
||||
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'section_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).default_section_id.id,
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
section_id = vals.get('section_id', False)
|
||||
invoice_type = context.get('type', False)
|
||||
user_id = vals.get('user_id', False)
|
||||
if not section_id and invoice_type in ['out_invoice', 'out_refund'] and user_id:
|
||||
vals['section_id'] = user_id
|
||||
obj_id = super(account_invoice, self).create(cr, uid, vals, context=context)
|
||||
return obj_id
|
||||
|
||||
account_invoice()
|
||||
|
||||
|
||||
class res_users(osv.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
_columns = {
|
||||
'default_section_id': fields.many2one('crm.case.section', 'Default Sales Team'),
|
||||
}
|
||||
|
||||
res_users()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -46,5 +46,47 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Update account invoice !-->
|
||||
<record model="ir.ui.view" id="account_invoice_form">
|
||||
<field name="name">Account Invoice</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='date_invoice']" position="after">
|
||||
<field name="section_id"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Update user form !-->
|
||||
<record model="ir.ui.view" id="res_user_form">
|
||||
<field name="name">Users Preferences</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='email']" position="after">
|
||||
<field name="default_section_id"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Update Preferences form !-->
|
||||
<record id="view_users_form_preferences" model="ir.ui.view">
|
||||
<field name="name">res.users.preferences.form</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='company_id']" position="after">
|
||||
<field name="default_section_id"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue