From 3efc458620a26c0fc4192238238e2d8ff39053af Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 19 Jan 2009 16:00:59 +0530 Subject: [PATCH 1/5] Account_report: Correction bzr revid: jvo@tinyerp.com-20090119103059-bmq1vagc91hkhxea --- .../account_report/report/print_indicator.py | 37 ++++++++++--------- .../account_report/report/print_indicator.rml | 26 ++++++++----- .../wizard/wizard_print_indicators.py | 4 +- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/addons/account_report/report/print_indicator.py b/addons/account_report/report/print_indicator.py index d7693c8f7ab..e13fe58383f 100644 --- a/addons/account_report/report/print_indicator.py +++ b/addons/account_report/report/print_indicator.py @@ -98,56 +98,59 @@ class accounting_report_indicator(report_sxw.rml_parse): self.header_name = [] self.header_val = [] self.main_dict = {} - + def repeatIn(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[],data=''): self._node.data = '' node = self._find_parent(self._node, nodes_parent or parents) ns = node.nextSibling #start - if not name=='array': + if (not name in ['array','array_header']): return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False) array_header = eval(data,{'year':'Fiscal Year','periods':'Periods'}) value = [array_header] value.extend(self.header_name) - - type=['string'].extend(['float']*len(self.header_name)) - width=[40]*(len(self.header_name)+1) + type=['string'] + if name=='array': + type.extend(['float']*len(self.header_name)) + else: + type=['lable'] * (len(self.header_name)+1) + + width = [538/float(len(value))]*(len(value)) + if not lst: lst.append(1) for ns in node.childNodes : if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and td : width_str = ns._attrs['colWidths'].nodeValue ns.removeAttribute('colWidths') - total_td = td * len(value) - +# total_td = td * len(value) + if not width: for v in value: width.append(30) - for v in range(len(value)): + for v in range(len(width)): width_str +=',%d'%width[v] - ns.setAttribute('colWidths',width_str) child_list = ns.childNodes - check=0 for child in child_list: if child.nodeName=='tr': lc = child.childNodes[1] -# for t in range(td): i=0 for v in value: newnode = lc.cloneNode(1) - if check==1: - t1="[[ %s['%s'] ]]"%(name,v) - else: + if type[i] == 'float': + t1="[[ '%.2f' % " + "%s['%s'] ]]"%(name,v) + if type[i] == 'lable': t1="%s"%(v) - newnode.childNodes[1].lastChild.data = t1 + else: + t1="[[ %s['%s'] ]]"%(name,v) + newnode.childNodes[1].lastChild.data = t1 child.appendChild(newnode) newnode=False i+=1 - check=1 return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False) def lines(self,data): @@ -190,7 +193,7 @@ class accounting_report_indicator(report_sxw.rml_parse): temp_dict=zip(self.header_name,self.header_val) res=dict(temp_dict) array_header = eval(array_header,{'year':'Fiscal Year','periods':'Periods'}) - res[array_header]='Value' + res[array_header]=object['name'] result.append(res) return result diff --git a/addons/account_report/report/print_indicator.rml b/addons/account_report/report/print_indicator.rml index 93943ec670c..9a504e68e67 100644 --- a/addons/account_report/report/print_indicator.rml +++ b/addons/account_report/report/print_indicator.rml @@ -150,22 +150,30 @@
- [[ repeatIn(lines(data['form']),'o')]] - [[ o['array_table'] and repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]] + [[ repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array_header',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]] - - - - - - + +
-
+
+ [[ repeatIn(lines(data['form']),'o')]] + [[ repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]] + + + + + + + + + +
+ diff --git a/addons/account_report/wizard/wizard_print_indicators.py b/addons/account_report/wizard/wizard_print_indicators.py index c1cd16f3469..1a7a8d1da74 100644 --- a/addons/account_report/wizard/wizard_print_indicators.py +++ b/addons/account_report/wizard/wizard_print_indicators.py @@ -54,8 +54,8 @@ def _load_base(self, cr, uid, data, context): return data['form'] def _check_len(self, cr, uid, data, context): - if len(data['form']['base_selection'][0][2])>12: - raise wizard.except_wizard('User Error!',"Please select maximum 12 records to fit the page-width.") + if len(data['form']['base_selection'][0][2])>8: + raise wizard.except_wizard('User Error!',"Please select maximum 8 records to fit the page-width.") return data['form'] class wizard_print_indicators(wizard.interface): From b5a174257b9c128d80a7e19f2f868e19f87cc881 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 19 Jan 2009 16:58:39 +0530 Subject: [PATCH 2/5] Bug 318712 lp bug: https://launchpad.net/bugs/318712 fixed bzr revid: jvo@tinyerp.com-20090119112839-7vg8tj513ottxtif --- addons/account_payment/payment.py | 10 +++++----- addons/account_payment/payment_view.xml | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/account_payment/payment.py b/addons/account_payment/payment.py index 0137ad9e9cf..08f5615242e 100644 --- a/addons/account_payment/payment.py +++ b/addons/account_payment/payment.py @@ -93,9 +93,9 @@ class payment_order(osv.osv): return res _columns = { - 'date_planned': fields.date('Scheduled date if fixed',help='Select a date if you have chosen Preferred Date to be fixed.'), - 'reference': fields.char('Reference',size=128,required=1), - 'mode': fields.many2one('payment.mode','Payment mode', select=True, required=1,help='Select the Payment Mode to be applied.'), + 'date_planned': fields.date('Scheduled date if fixed', states={'done':[('readonly',True)]}, help='Select a date if you have chosen Preferred Date to be fixed.'), + 'reference': fields.char('Reference', size=128, required=1, states={'done':[('readonly',True)]}), + 'mode': fields.many2one('payment.mode','Payment mode', select=True, required=1, states={'done':[('readonly',True)]}, help='Select the Payment Mode to be applied.'), 'state': fields.selection([ ('draft', 'Draft'), ('open','Confirmed'), @@ -104,12 +104,12 @@ class payment_order(osv.osv): 'line_ids': fields.one2many('payment.line','order_id','Payment lines',states={'done':[('readonly',True)]}), 'total': fields.function(_total, string="Total", method=True, type='float'), - 'user_id': fields.many2one('res.users','User',required=True), + 'user_id': fields.many2one('res.users','User', required=True, states={'done':[('readonly',True)]}), 'date_prefered': fields.selection([ ('now', 'Directly'), ('due', 'Due date'), ('fixed', 'Fixed date') - ], "Preferred date", change_default=True, required=True,help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."), + ], "Preferred date", change_default=True, required=True, states={'done':[('readonly',True)]}, help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."), 'date_created': fields.date('Creation date', readonly=True), 'date_done': fields.date('Execution date', readonly=True), } diff --git a/addons/account_payment/payment_view.xml b/addons/account_payment/payment_view.xml index 4f476339b49..6c919f66bf0 100644 --- a/addons/account_payment/payment_view.xml +++ b/addons/account_payment/payment_view.xml @@ -177,7 +177,7 @@ - Payment order + Payment Orders payment.order form tree,form @@ -185,22 +185,22 @@ - Draft payment order + Draft Payment Order payment.order form tree,form [('state','=','draft')] - + - Payment orders to validate + Payment Orders to Validate payment.order form tree,form [('state','=','open')] - + New Payment Order @@ -208,7 +208,7 @@ form form,tree - + From 095558d2a6252fab1d65981c1cea7b91caa6e4e7 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Mon, 19 Jan 2009 19:29:11 +0530 Subject: [PATCH 3/5] account bzr revid: mra@tinyerp.com-20090119135911-haorjopuozgsxght --- addons/account/account_invoice_view.xml | 2 ++ addons/account/invoice.py | 6 +++++- addons/purchase/purchase.py | 14 ++++++++------ addons/purchase/purchase_view.xml | 11 ++++++----- addons/sale/sale.py | 6 ++++-- addons/sale/sale_view.xml | 1 + 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 7e99762a5ac..eb196fa6a8e 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -197,6 +197,7 @@ + @@ -283,6 +284,7 @@ + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index e0854cf3eae..a560b094b40 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -270,6 +270,7 @@ class account_invoice(osv.osv): help="Remaining amount due."), 'payment_ids': fields.function(_compute_lines, method=True, relation='account.move.line', type="many2many", string='Payments'), 'move_name': fields.char('Account Move', size=64), + 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position') } _defaults = { 'type': _get_type, @@ -305,6 +306,7 @@ class account_invoice(osv.osv): partner_payment_term = False acc_id = False bank_id = False + fiscal_position = False opt = [('uid', str(uid))] if partner_id: @@ -318,7 +320,8 @@ class account_invoice(osv.osv): acc_id = p.property_account_receivable.id else: acc_id = p.property_account_payable.id - + if p.property_account_position: + fiscal_position = p.property_account_position.id partner_payment_term = p.property_payment_term and p.property_payment_term.id or False if p.bank_ids: bank_id = p.bank_ids[0].id @@ -328,6 +331,7 @@ class account_invoice(osv.osv): 'address_invoice_id': invoice_addr_id, 'account_id': acc_id, 'payment_term': partner_payment_term, + 'fiscal_position': fiscal_position } } diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 3385b3eafe3..80e32bcfa42 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -184,6 +184,7 @@ class purchase_order(osv.osv): store={ 'purchase.order.line': (_get_order, None, 10), }, multi="sums"), + 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position') } _defaults = { 'date_order': lambda *a: time.strftime('%Y-%m-%d'), @@ -198,7 +199,7 @@ class purchase_order(osv.osv): _name = "purchase.order" _description = "Purchase order" _order = "name desc" - + def unlink(self, cr, uid, ids): purchase_orders = self.read(cr, uid, ids, ['state']) unlink_ids = [] @@ -207,8 +208,8 @@ class purchase_order(osv.osv): unlink_ids.append(s['id']) else: raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!' % s['state'])) - return osv.osv.unlink(self, cr, uid, unlink_ids) - + return osv.osv.unlink(self, cr, uid, unlink_ids) + def button_dummy(self, cr, uid, ids, context={}): return True @@ -227,11 +228,12 @@ class purchase_order(osv.osv): def onchange_partner_id(self, cr, uid, ids, part): if not part: - return {'value':{'partner_address_id': False}} + return {'value':{'partner_address_id': False, 'fiscal_position': False}} addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default']) part = self.pool.get('res.partner').browse(cr, uid, part) pricelist = part.property_product_pricelist_purchase.id - return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist}} + fiscal_position = part.property_account_position and part.property_account_position.id or False + return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist, 'fiscal_position': fiscal_position}} def wkf_approve_order(self, cr, uid, ids, context={}): self.write(cr, uid, ids, {'state': 'approved', 'date_approve': time.strftime('%Y-%m-%d')}) diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index dfe3f205c16..c0398b8bd5a 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -82,6 +82,7 @@ + @@ -206,11 +207,11 @@ diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 907dbe775ab..165979976f4 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -250,6 +250,7 @@ class sale_order(osv.osv): 'invoice_quantity': fields.selection([('order','Ordered Quantities'),('procurement','Shipped Quantities')], 'Invoice on', help="The sale order will automatically create the invoice proposition (draft invoice). Ordered and delivered quantities may not be the same. You have to choose if you invoice based on ordered or shipped quantities. If the product is a service, shipped quantities means hours spent on the associated tasks.",required=True), 'payment_term' : fields.many2one('account.payment.term', 'Payment Term'), + 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position') } _defaults = { 'picking_policy': lambda *a: 'direct', @@ -303,12 +304,13 @@ class sale_order(osv.osv): def onchange_partner_id(self, cr, uid, ids, part): if not part: - return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False}} + return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False, 'fiscal_position': False}} addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery','invoice','contact']) part = self.pool.get('res.partner').browse(cr, uid, part) pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False payment_term = part.property_payment_term and part.property_payment_term.id or False - return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term}} + fiscal_position = part.property_account_position and part.property_account_position.id or False + return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term, 'fiscal_position': fiscal_position}} def shipping_policy_change(self, cr, uid, ids, policy, context={}): if not policy: diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 609ac3b6590..5ef60c4e2ad 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -206,6 +206,7 @@ + From 0319c6e65b2d0e1dc318dc0ad031224a98a0d9b5 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 19 Jan 2009 19:38:16 +0530 Subject: [PATCH 4/5] Bug 318712 lp bug: https://launchpad.net/bugs/318712 fixed bzr revid: jvo@tinyerp.com-20090119140816-ykiklek1laopuvrr --- addons/account_payment/payment_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_payment/payment_view.xml b/addons/account_payment/payment_view.xml index 6c919f66bf0..36009a105bd 100644 --- a/addons/account_payment/payment_view.xml +++ b/addons/account_payment/payment_view.xml @@ -96,7 +96,7 @@ -