1
# -*- encoding: utf-8 -*-
2
###########################################################################
3
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (c) 2010 moylop260 - http://moylop.blogspot.com/
7
# info moylop260 (moylop260@hotmail.com)
8
############################################################################
9
# Coded by: moylop260 (moylop260@hotmail.com)
10
# Launchpad Project Manager for Publication: Nhomar Hernandez - nhomar@openerp.com.ve
11
############################################################################
13
# This program is free software: you can redistribute it and/or modify
14
# it under the terms of the GNU Affero General Public License as
15
# published by the Free Software Foundation, either version 3 of the
16
# License, or (at your option) any later version.
18
# This program is distributed in the hope that it will be useful,
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
# GNU Affero General Public License for more details.
23
# You should have received a copy of the GNU Affero General Public License
24
# along with this program. If not, see <http://www.gnu.org/licenses/>.
26
##############################################################################
29
from osv import fields
31
from tools.translate import _
36
class account_payment_term(osv.osv):
37
_inherit = "account.payment.term"
39
def compute(self, cr, uid, id, value, date_ref=False, context={}):
42
date_ref = time.strftime('%Y-%m-%d', time.strptime(date_ref, '%Y-%m-%d %H:%M:%S'))
45
return super(account_payment_term, self).compute(cr, uid, id, value, date_ref, context=context)
46
account_payment_term()
48
class account_invoice(osv.osv):
49
_inherit = 'account.invoice'
50
_order = 'date_invoice asc'
53
##Extract date_invoice from original, but add datetime
54
'date_invoice': fields.datetime('Date Invoiced', states={'open':[('readonly',True)],'close':[('readonly',True)]}, help="Keep empty to use the current date"),
58
#'date_invoice': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
61
def action_move_create(self, cr, uid, ids, *args):
62
for inv in self.browse(cr, uid, ids):
65
if not inv.date_invoice:
66
self.write(cr, uid, [inv.id], {'date_invoice': time.strftime('%Y-%m-%d %H:%M:%S')})
67
return super(account_invoice, self).action_move_create(cr, uid, ids, *args)