2
##############################################################################
4
# Copyright (c) 2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
6
# WARNING: This program as such is intended to be used by professional
7
# programmers who take the whole responsability of assessing all potential
8
# consequences resulting from its eventual inadequacies and bugs
9
# End users who are looking for a ready-to-use solution with commercial
10
# garantees and support are strongly adviced to contract a Free Software
13
# This program is Free Software; you can redistribute it and/or
14
# modify it under the terms of the GNU General Public License
15
# as published by the Free Software Foundation; either version 2
16
# of the 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 General Public License for more details.
23
# You should have received a copy of the GNU General Public License
24
# along with this program; if not, write to the Free Software
25
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
##############################################################################
29
from osv import fields,osv
35
class sale_order(osv.osv):
36
_inherit = "sale.order"
39
'published_customer': fields.many2one('res.partner','Published Customer'),
40
'advertising_agency': fields.many2one('res.partner','Advertising Agency'),
43
def onchange_published_customer(self, cursor, user, ids ,published_customer):
44
data = {'advertising_agency':published_customer,'partner_id':published_customer,'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False}
45
if published_customer:
46
address = self.onchange_partner_id(cursor, user, ids, published_customer)
47
data.update(address['value'])
48
return {'value' : data}
50
def onchange_advertising_agency(self, cursor, user, ids, ad_agency):
51
data = {'partner_id':ad_agency,'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False}
53
address = self.onchange_partner_id(cursor, user, ids, ad_agency)
54
data.update(address['value'])
55
return {'value' : data}
59
class sale_advertising_issue(osv.osv):
60
_name = "sale.advertising.issue"
61
_description="Sale Advertising Issue"
63
'name': fields.char('Name', size=32, required=True),
64
'issue_date': fields.date('Issue Date', required=True),
65
'medium': fields.many2one('product.category','Medium', required=True),
66
'state': fields.selection([('open','Open'),('close','Close')], 'State'),
67
'default_note': fields.text('Default Note'),
70
'issue_date': lambda *a: time.strftime('%Y-%m-%d'),
71
'state': lambda *a: 'open',
74
sale_advertising_issue()
76
class sale_order_line(osv.osv):
77
_inherit = "sale.order.line"
79
'layout_remark': fields.text('Layout Remark'),
80
'adv_issue': fields.many2one('sale.advertising.issue','Advertising Issue'),
81
'page_reference': fields.char('Reference of the Page', size=32),
82
'from_date': fields.datetime('Start of Validity'),
83
'to_date': fields.datetime('End of Validity'),
87
class product_product(osv.osv):
88
_inherit = "product.product"
90
'equivalency_in_A4': fields.float('A4 Equivalency'),
94
class sale_advertising_proof(osv.osv):
95
_name = "sale.advertising.proof"
96
_description="Sale Advertising Proof"
98
'name': fields.char('Name', size=32, required=True),
99
'address_id':fields.many2one('res.partner.address','Delivery Address', required=True),
100
'number': fields.integer('Number of Copies', required=True),
101
'target_id': fields.many2one('sale.order','Target', required=True),
104
'number': lambda *a: 1,
106
sale_advertising_proof()