[REF] purchase: search view of purchase order and form view of merge order wizard
[odoo/odoo.git] / addons / l10n_ch / dta.py
1 # -*- coding: utf-8 -*-
2 #  dat.py
3 #  l10n_ch
4 #
5 #  Created by Nicolas Bessi based on Credric Krier contribution
6 #
7 #  Copyright (c) 2009 CamptoCamp. All rights reserved.
8 ##############################################################################
9 #
10 # WARNING: This program as such is intended to be used by professional
11 # programmers who take the whole responsability of assessing all potential
12 # consequences resulting from its eventual inadequacies and bugs
13 # End users who are looking for a ready-to-use solution with commercial
14 # garantees and support are strongly adviced to contract a Free Software
15 # Service Company
16 #
17 # This program is Free Software; you can redistribute it and/or
18 # modify it under the terms of the GNU General Public License
19 # as published by the Free Software Foundation; either version 2
20 # of the License, or (at your option) any later version.
21 #
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 # GNU General Public License for more details.
26 #
27 # You should have received a copy of the GNU General Public License
28 # along with this program; if not, write to the Free Software
29 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
30 #
31 ##############################################################################
32
33 import time
34 from osv import osv,fields
35
36 class account_dta(osv.osv):
37     """class that implements bank DTA File format, 
38     used to transfert bulk batch payment instruction to a bank"""
39     _name = "account.dta"
40     _description = "DTA History"
41     _columns = {
42         ### name of the file 
43         'name': fields.binary('DTA file', readonly=True),
44         ### list of dta line linked to the dta order
45         'dta_line_ids': fields.one2many('account.dta.line','dta_id','DTA lines', readonly=True), 
46         ## textual notes
47         'note': fields.text('Creation log', readonly=True, 
48             help="Displays the problem during dta generation"),
49         ### bank how will execute DTA order
50         'bank': fields.many2one('res.partner.bank','Bank', readonly=True,select=True,
51             help="Bank how will execute DTA order"),
52         ### date of DTA order generation 
53         'date': fields.date('Creation Date', readonly=True,select=True,
54             help="Date of DTA order generation"),
55         ### user how generate the DTA order
56         'user_id': fields.many2one('res.users','User', readonly=True, select=True),
57     }
58 account_dta()
59
60 class account_dta_line(osv.osv):
61     """Class that represent a DTA order line, 
62     each lin corressponds to a payment instruction"""
63     _name = "account.dta.line"
64     _description = "DTA line"
65     _columns = {
66         ### name of the line 
67         'name' : fields.many2one('account.invoice','Invoice', required=True, size=256),
68         ### partner how will receive payments
69         'partner_id' : fields.many2one('res.partner','Partner',
70             help="Partenr to pay"),
71         ### due date of the payment
72         'due_date' : fields.date('Due date'),
73         ### date of the supplier invoice to pay
74         'invoice_date' : fields.date('Invoice date'),
75         ### cash discount date
76         'cashdisc_date' : fields.date('Cash Discount date'),
77         ### amount effectively paied on this line 
78         'amount_to_pay' : fields.float('Amount to pay', 
79             help="Amount effectively paid"),
80         ### amount that was on the supplier invoice
81         'amount_invoice': fields.float('Invoiced Amount',
82             help="Amount to pay base on the supplier invoice"),
83         ### Cash discount amount 
84         'amount_cashdisc': fields.float('Cash Discount Amount'),
85         ### Linke to the main dta order
86         'dta_id': fields.many2one('account.dta','Associated DTA', required=True, ondelete='cascade'),
87         ### state of the invoice Drat, Cancel, Done
88         'state' : fields.selection([('draft','Draft'),('cancel','Error'),('done','Paid')],'State')
89     }
90     _defaults = {
91         'state' : lambda *a :'draft',
92     }
93 account_dta_line()
94
95
96 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: