-# -*- encoding: utf-8 -*-
+# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
-# $Id$
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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.
+# it under the terms of the GNU Affero 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.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
+# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
class res_company(osv.osv):
_inherit = "res.company"
_columns = {
- 'overdue_msg' : fields.text('Overdue Payments Message'),
+ 'overdue_msg': fields.text('Overdue Payments Message', translate=True),
+ 'property_reserve_and_surplus_account': fields.property(
+ 'account.account',
+ type='many2one',
+ relation='account.account',
+ string="Reserve and Profit/Loss Account",
+ method=True,
+ view_load=True,
+ domain="[('type', '=', 'other')]",
+ help="This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profit & Loss Report"),
}
_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'
+ 'overdue_msg': 'Please note that the following payments are now due. If your payment \
+ has been sent, kindly forward your payment details. If payment will be \
+ delayed further, please contact us to discuss. \
+ \nWould your payment have been carried out after this mail was sent, please consider the present one as void.'
}
-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',
- }
+res_company()
-company_setup()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file