[rem] account: todo item for the initial configuration of the overdue payment message
bzr revid: xmo@tinyerp.com-20100123163301-j2inxvabl7diqg6f
This commit is contained in:
parent
dda93d798d
commit
1050ee55d1
|
@ -33,52 +33,3 @@ 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'
|
||||
_inherit = 'res.config'
|
||||
|
||||
_columns = {
|
||||
'company_id':fields.many2one('res.company','Company',required=True),
|
||||
'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,
|
||||
'overdue_msg': get_message,
|
||||
}
|
||||
|
||||
def onchange_company_id(self, cr, uid, ids, company, context=None):
|
||||
if not company:
|
||||
return {}
|
||||
comp_obj = self.pool.get('res.company').browse(cr,uid,company)
|
||||
partner_address = comp_obj.partner_id.address
|
||||
if partner_address and partner_address[0].phone:
|
||||
msg_tail = ' at %s.'%(partner_address[0].phone)
|
||||
else:
|
||||
msg_tail = '.'
|
||||
|
||||
return {'value': {'overdue_msg': comp_obj.overdue_msg + msg_tail } }
|
||||
|
||||
def execute(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']})
|
||||
company_setup()
|
||||
|
|
|
@ -15,45 +15,5 @@
|
|||
</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="inherit_id" ref="base.res_config_view_base"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<form position="attributes">
|
||||
<attribute name="string">Overdue Payment Report Message</attribute>
|
||||
</form>
|
||||
<group string="res_config_contents" position="replace">
|
||||
<field name="company_id" select="1"
|
||||
on_change="onchange_company_id(company_id)"
|
||||
groups="base.group_multi_company"/>
|
||||
<separator string="Message" colspan="4"/>
|
||||
<field name="overdue_msg" nolabel="1" colspan="4"/>
|
||||
</group>
|
||||
<xpath expr='//button[@name="action_skip"]' position='replace'/>
|
||||
</data>
|
||||
</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_id" ref="wizard_company_setup_form"/>
|
||||
<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="action_id" ref="action_wizard_company_setup_form"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -87,6 +87,3 @@
|
|||
"access_account_fiscal_position_account_template","account.fiscal.position.account.template","model_account_fiscal_position_account_template","account.group_account_manager",1,1,1,1
|
||||
"access_account_sequence_fiscal_year","account.sequence.fiscalyear","model_account_sequence_fiscalyear","account.group_account_user",1,1,1,1
|
||||
"access_account_sequence_fiscal_year_user","account.sequence.fiscalyear user","model_account_sequence_fiscalyear","base.group_user",1,0,0,0
|
||||
"access_wizard_company_setup_manager","wizard.company.setup manager","model_wizard_company_setup","account.group_account_manager",1,1,1,1
|
||||
"access_wizard_company_setup","wizard.company.setup","model_wizard_company_setup","account.group_account_user",1,0,0,0
|
||||
"access_wizard_company_setup_user","wizard.company.setup user","model_wizard_company_setup","base.group_user",1,0,0,0
|
||||
|
|
|
Loading…
Reference in New Issue