From 68686b10740e2b5b613a7962c2f664acb0c998bb Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 17 Aug 2010 11:18:28 +0530 Subject: [PATCH] [IMP] Account_invoice_layout bzr revid: mra@mra-laptop-20100817054828-splbbuyn10jfgsn0 --- addons/account_invoice_layout/__init__.py | 5 ++-- addons/account_invoice_layout/__openerp__.py | 2 +- .../account_invoice_layout.py | 27 ++++++++++--------- .../account_invoice_layout_report.xml | 6 ----- .../account_invoice_layout_view.xml | 5 ++-- .../report/report_account_invoice_layout.py | 6 ++--- .../report/special_message_invoice.py | 5 ++-- .../account_invoice_layout/wizard/__init__.py | 1 + .../wizard/account_invoice_special_message.py | 7 +++-- 9 files changed, 33 insertions(+), 31 deletions(-) diff --git a/addons/account_invoice_layout/__init__.py b/addons/account_invoice_layout/__init__.py index 89827ee40ad..779249d794c 100644 --- a/addons/account_invoice_layout/__init__.py +++ b/addons/account_invoice_layout/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,12 +15,13 @@ # 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 . +# along with this program. If not, see . # ############################################################################## import account_invoice_layout import report import wizard + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_invoice_layout/__openerp__.py b/addons/account_invoice_layout/__openerp__.py index c0503539956..77a6e428de6 100644 --- a/addons/account_invoice_layout/__openerp__.py +++ b/addons/account_invoice_layout/__openerp__.py @@ -37,7 +37,7 @@ """, 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', - 'depends': ['base', 'account'], + 'depends': ['account'], 'init_xml': [], 'update_xml': [ 'security/ir.model.access.csv', diff --git a/addons/account_invoice_layout/account_invoice_layout.py b/addons/account_invoice_layout/account_invoice_layout.py index c4a4f64efbe..e596dd0a959 100644 --- a/addons/account_invoice_layout/account_invoice_layout.py +++ b/addons/account_invoice_layout/account_invoice_layout.py @@ -19,22 +19,21 @@ # ############################################################################## -from osv import fields,osv - +from osv import fields, osv class notify_message(osv.osv): _name = 'notify.message' _description = 'Notify By Messages' _columns = { - 'name' : fields.char('Title', size=64, required=True), - 'msg' : fields.text('Special Message', size=125, required=True, help='This notification will appear at the bottom of the Invoices when printed.', translate=True) + 'name': fields.char('Title', size=64, required=True), + 'msg': fields.text('Special Message', size=128, required=True, help='This notification will appear at the bottom of the Invoices when printed.', translate=True) } notify_message() class account_invoice_line(osv.osv): - def move_line_get_item(self, cr, uid, line, context={}): + def move_line_get_item(self, cr, uid, line, context=None): if line.state != 'article': return None return super(account_invoice_line, self).move_line_get_item(cr, uid, line, context) @@ -70,7 +69,7 @@ class account_invoice_line(osv.osv): res[field]['states'][key] = value return res - def onchange_invoice_line_view(self, cr, uid, id, type, context={}, *args): + def onchange_invoice_line_view(self, cr, uid, id, type, context=None, *args): if (not type): return {} @@ -131,7 +130,7 @@ class account_invoice_line(osv.osv): default['state'] = self.browse(cr, uid, id).state return super(account_invoice_line, self).copy_data(cr, uid, id, default, context) - def _fnct(self, cr, uid, id, name, args, context): + def _fnct(self, cr, uid, id, name, args, context=None): res = {} for m in self.browse(cr, uid, id): if m.state != 'article': @@ -165,18 +164,19 @@ class account_invoice_line(osv.osv): def _default_account(self, cr, uid, context=None): cr.execute("select id from account_account where parent_id IS NULL LIMIT 1") - res=cr.fetchone() + res = cr.fetchone() return res[0] _defaults = { - 'state': lambda *a: 'article', - 'sequence': lambda *a : 0, + 'state': 'article', + 'sequence': 0, # 'account_id': _default_account } + account_invoice_line() - class one2many_mod2(fields.one2many): + def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): if not context: context = {} @@ -210,6 +210,7 @@ class account_invoice(osv.osv): 'abstract_line_ids': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines',readonly=True, states={'draft':[('readonly',False)]}), 'invoice_line': one2many_mod2('account.invoice.line', 'invoice_id', 'Invoice Lines',readonly=True, states={'draft':[('readonly',False)]}), } -account_invoice() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +account_invoice() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_invoice_layout/account_invoice_layout_report.xml b/addons/account_invoice_layout/account_invoice_layout_report.xml index 747bc83d4c2..4b21fcd5b33 100644 --- a/addons/account_invoice_layout/account_invoice_layout_report.xml +++ b/addons/account_invoice_layout/account_invoice_layout_report.xml @@ -1,12 +1,6 @@ - + @@ -73,6 +74,7 @@
+ @@ -83,10 +85,9 @@ form tree,form + - -
diff --git a/addons/account_invoice_layout/report/report_account_invoice_layout.py b/addons/account_invoice_layout/report/report_account_invoice_layout.py index b2c1f37fb2b..54c0daadb79 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.py +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,12 +15,12 @@ # 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 . +# along with this program. If not, see . # ############################################################################## import time -import pooler + from report import report_sxw class account_invoice_1(report_sxw.rml_parse): diff --git a/addons/account_invoice_layout/report/special_message_invoice.py b/addons/account_invoice_layout/report/special_message_invoice.py index fdda2e65278..aaa79787072 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.py +++ b/addons/account_invoice_layout/report/special_message_invoice.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,11 +15,12 @@ # 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 . +# along with this program. If not, see . # ############################################################################## import time + from report import report_sxw import pooler diff --git a/addons/account_invoice_layout/wizard/__init__.py b/addons/account_invoice_layout/wizard/__init__.py index 3b724adbe39..87cfa0d263b 100644 --- a/addons/account_invoice_layout/wizard/__init__.py +++ b/addons/account_invoice_layout/wizard/__init__.py @@ -20,5 +20,6 @@ ############################################################################## import account_invoice_special_message + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_invoice_layout/wizard/account_invoice_special_message.py b/addons/account_invoice_layout/wizard/account_invoice_special_message.py index 5936e4c1579..adc3261fa64 100644 --- a/addons/account_invoice_layout/wizard/account_invoice_special_message.py +++ b/addons/account_invoice_layout/wizard/account_invoice_special_message.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # ############################################################################## + from osv import osv, fields class account_invoice_special_msg(osv.osv_memory): @@ -32,17 +33,19 @@ class account_invoice_special_msg(osv.osv_memory): datas = {} if context is None: context = {} + data = self.read(cr, uid, ids, [])[0] datas = { 'ids': context.get('active_ids',[]), 'model': 'account.invoice', 'form': data - } + } return { 'type': 'ir.actions.report.xml', 'report_name': 'notify_account.invoice', 'datas': datas, - } + } account_invoice_special_msg() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file