[FIX] Account : Added Configuration wizard to make overdue payment report message configurable on company
lp bug: https://launchpad.net/bugs/389540 fixed bzr revid: jvo@tinyerp.com-20090624130613-0xkhxttppgfzzv9s
This commit is contained in:
parent
e0f5685507
commit
a6c69a3c41
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -31,6 +31,6 @@ import wizard
|
|||
import report
|
||||
import product
|
||||
import sequence
|
||||
|
||||
import company
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -59,7 +59,8 @@
|
|||
'process/statement_process.xml',
|
||||
'process/customer_invoice_process.xml',
|
||||
'process/supplier_invoice_process.xml',
|
||||
'sequence_view.xml'
|
||||
'sequence_view.xml',
|
||||
'company_view.xml',
|
||||
],
|
||||
'demo_xml': [
|
||||
'account_demo.xml',
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
class res_company(osv.osv):
|
||||
_inherit = "res.company"
|
||||
_columns = {
|
||||
'overdue_msg' : fields.text('Overdue Payments Message'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'overdue_msg': lambda *a: 'Would your payment have been carried \
|
||||
out after this mail was sent, please consider the present one as \
|
||||
void. Do not hesitate to contact our accounting department'
|
||||
}
|
||||
res_company()
|
||||
|
||||
class company_setup(osv.osv_memory):
|
||||
"""
|
||||
Insert Information for a company.
|
||||
Wizard asks for:
|
||||
* A Company with its partner
|
||||
* Insert a suitable message for Overdue Payment Report.
|
||||
"""
|
||||
_name='wizard.company.setup'
|
||||
|
||||
_columns = {
|
||||
'company_id':fields.many2one('res.company','Company',required=True),
|
||||
'partner_id':fields.many2one('res.partner','Partner'),
|
||||
'overdue_msg': fields.text('Overdue Payment Message'),
|
||||
}
|
||||
def get_message(self,cr,uid,context={}):
|
||||
company =self.pool.get('res.users').browse(cr,uid,[uid],context)[0].company_id
|
||||
msg = company.overdue_msg
|
||||
phone = company.partner_id.address and (company.partner_id.address[0].phone and ' at ' + str(company.partner_id.address[0].phone) + '.' or '.') or '.'
|
||||
msg += str(phone)
|
||||
return msg
|
||||
|
||||
_defaults = {
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr,uid,[uid],c)[0].company_id.id,
|
||||
'partner_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr,uid,[uid],c)[0].company_id.partner_id.id,
|
||||
'overdue_msg': get_message,
|
||||
}
|
||||
|
||||
def onchange_company_id(self, cr, uid, ids, company, context=None):
|
||||
res = {}
|
||||
if not company:
|
||||
return {}
|
||||
comp_obj = self.pool.get('res.company').browse(cr,uid,company)
|
||||
res['partner_id'] = comp_obj.partner_id.id
|
||||
phone = comp_obj.partner_id.address and (comp_obj.partner_id.address[0].phone and ' at ' + str(comp_obj.partner_id.address[0].phone) + '.' or '.') or '.'
|
||||
res['overdue_msg'] = comp_obj.overdue_msg + str(phone)
|
||||
|
||||
return {'value': res }
|
||||
|
||||
def action_create(self, cr, uid, ids, context=None):
|
||||
content_wiz = self.pool.get('wizard.company.setup').read(cr,uid,ids,['company_id','overdue_msg'])
|
||||
if content_wiz:
|
||||
wiz_data = content_wiz[0]
|
||||
self.pool.get('res.company').write(cr, uid, [wiz_data['company_id']], {'overdue_msg':wiz_data['overdue_msg']})
|
||||
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
'res_model': 'ir.actions.configuration.wizard',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target':'new',
|
||||
}
|
||||
|
||||
def action_cancel(self,cr,uid,ids,conect=None):
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
'res_model': 'ir.actions.configuration.wizard',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target':'new',
|
||||
}
|
||||
|
||||
company_setup()
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_company_inherit_form">
|
||||
<field name="name">res.company.form.inherit</field>
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="model">res.company</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<notebook>
|
||||
<page string="Overdue Payments" position="inside">
|
||||
<separator string="Overdue Payments Message" colspan="4"/>
|
||||
<field name="overdue_msg" nolabel="1" colspan ="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Wizard for Configuration of Overdue Payments -->
|
||||
|
||||
<record model="ir.ui.view" id="wizard_company_setup_form">
|
||||
<field name="name">wizard.company.setup.form</field>
|
||||
<field name="model">wizard.company.setup</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Overdue Payment Report Message">
|
||||
<field name="company_id" select="1" on_change="onchange_company_id(company_id)"/>
|
||||
<field name="partner_id" select="1" readonly="1"/>
|
||||
<separator string="Message" colspan="4"/>
|
||||
<field name="overdue_msg" nolabel="1" colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button icon="gtk-cancel" special="cancel" type="object" name="action_cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" name="action_create" string="Create" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_wizard_company_setup_form" model="ir.actions.act_window">
|
||||
<field name="name">Overdue Payment Report Message</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">wizard.company.setup</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- register configuration wizard -->
|
||||
|
||||
<record id="config_wizard_account_base_setup_form" model="ir.actions.todo">
|
||||
<field name="name">Overdue Payment Report Message</field>
|
||||
<field name="note">Specify The Message for the Overdue Payment Report.</field>
|
||||
<field name="action_id" ref="action_wizard_company_setup_form"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -127,7 +127,7 @@
|
|||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at +32 81 81 37 00.</para>
|
||||
<para style="terp_default_9">[[ company.overdue_msg ]]</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
@ -135,7 +135,7 @@
|
|||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="57.0,137.0,52.0,72.0,60.0,57.0,56.0,18.0" style="Table1">
|
||||
<blockTable colWidths="56.0,137.0,52.0,72.0,60.0,57.0,56.0,18.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Date</para>
|
||||
|
@ -165,7 +165,7 @@
|
|||
</blockTable>
|
||||
<section>
|
||||
<para style="terp_default_8">[[repeatIn(getLines(o), 'line') ]]</para>
|
||||
<blockTable colWidths="57.0,138.0,52.0,73.0,60.0,57.0,56.0,17.0" style="Table3">
|
||||
<blockTable colWidths="56.0,138.0,52.0,73.0,60.0,57.0,56.0,17.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ formatLang(line['date'],date=True) ]]</para>
|
||||
|
|
Loading…
Reference in New Issue