[MERGE] lp881356
[odoo/odoo.git] / addons / account / company.py
index e3a1979..4ad4d12 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #
@@ -15,7 +15,7 @@
 #    GNU Affero General Public License for more details.
 #
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
@@ -24,61 +24,26 @@ from osv import fields, osv
 class res_company(osv.osv):
     _inherit = "res.company"
     _columns = {
-        'overdue_msg' : fields.text('Overdue Payments Message', translate=True),
+        'paypal_account': fields.char("Paypal Account", size=128, help="Paypal username (usually email) for receiving online payments."),
+        '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",
+            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.), as calculated in 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'
-    }
-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'),
+        'overdue_msg': '''Our records indicate that the following payments are still due. If the amount
+has already been paid, please disregard this notice. However, if you have any
+queries regarding your account, please contact us.
+Thank you in advance.
+'''
     }
-    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 } }
+res_company()
 
-    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()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: