diff --git a/addons/event/wizard/make_invoice.py b/addons/event/wizard/make_invoice.py index 26118edd15b..c41a0748b55 100644 --- a/addons/event/wizard/make_invoice.py +++ b/addons/event/wizard/make_invoice.py @@ -113,6 +113,7 @@ def _makeInvoices(self, cr, uid, data, context): 'currency_id' :reg.partner_invoice_id.property_product_pricelist.currency_id.id, 'comment': "", 'payment_term':reg.partner_invoice_id.property_payment_term.id, + 'fiscal_position': reg.partner_invoice_id.property_account_position.id } inv_obj = pool_obj.get('account.invoice') diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index dd427fe5984..e7129cf00d5 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.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$ # @@ -152,6 +152,7 @@ class hr_expense_expense(osv.osv): 'price_type': 'tax_included', 'currency_id': exp.currency_id.id, 'payment_term': payment_term_id, + 'fiscal_position': exp.employee_id.address_id.partner_id.property_account_position.id } if payment_term_id: to_update = invoice_obj.onchange_payment_term_date_invoice(cr, uid, [], diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py index fb97b1a0b3c..742895d78e4 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py @@ -71,6 +71,7 @@ class final_invoice_create(wizard.interface): 'account_id': partner.property_account_receivable.id, 'currency_id': account.pricelist_id.currency_id.id, 'date_due': date_due, + 'fiscal_position': account.partner_id.property_account_position.id } last_invoice = pool.get('account.invoice').create(cr, uid, curr_invoice) invoices.append(last_invoice) diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index 0d2c7120503..a568f711874 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -79,6 +79,7 @@ class invoice_create(wizard.interface): 'account_id': partner.property_account_receivable.id, 'currency_id': account.pricelist_id.currency_id.id, 'date_due': date_due, + 'fiscal_position': account.partner_id.property_account_position.id } last_invoice = pool.get('account.invoice').create(cr, uid, curr_invoice) invoices.append(last_invoice) @@ -129,11 +130,11 @@ class invoice_create(wizard.interface): # Compute for lines # cr.execute("SELECT * " # TODO optimize this - " FROM account_analytic_line" + " FROM account_analytic_line" " WHERE account_id=%%s" " AND id IN (%s)" " AND product_id=%%s" - " AND to_invoice=%%s" % ','.join(['%s']*len(data['ids'])), + " AND to_invoice=%%s" % ','.join(['%s']*len(data['ids'])), (account.id, data['ids'], product_id, factor_id)) line_ids = cr.dictfetchall() note = [] diff --git a/addons/membership/membership.py b/addons/membership/membership.py index c34ed55126e..5c288ed5c98 100644 --- a/addons/membership/membership.py +++ b/addons/membership/membership.py @@ -364,10 +364,10 @@ class Partner(osv.osv): 'member_lines': fields.one2many('membership.membership_line', 'partner', 'Membership'), 'free_member': fields.boolean('Free member'), 'membership_amount': fields.float( - 'Membership amount', digites=(16, 2), + 'Membership amount', digites=(16, 2), help='The price negociated by the partner'), 'membership_state': fields.function( - _membership_state, method = True, + _membership_state, method = True, string = 'Current membership state', type = 'selection', selection = STATE ,store = { 'account.invoice':(_get_invoice_partner,['state'], 10), @@ -385,8 +385,8 @@ class Partner(osv.osv): } ), 'membership_stop': fields.function( - _membership_stop, method = True, - string = 'Stop membership date', type = 'date', + _membership_stop, method = True, + string = 'Stop membership date', type = 'date', store = { 'account.invoice':(_get_invoice_partner,['state'], 10), 'membership.membership_line':(_get_partner_id,['state'], 10), @@ -760,7 +760,7 @@ class account_invoice_line(osv.osv): if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to: date_from = line.invoice_id.date_invoice line_id = member_line_obj.create(cr, uid, { - 'partner': line.invoice_id.partner_id.id, + 'partner': line.invoice_id.partner_id and line.invoice_id.partner_id.id or False, 'date_from': date_from, 'date_to': date_to, 'account_invoice_line': line.id, diff --git a/addons/membership/wizard/invoice_membership.py b/addons/membership/wizard/invoice_membership.py index 02da0deeee4..1321bb38491 100644 --- a/addons/membership/wizard/invoice_membership.py +++ b/addons/membership/wizard/invoice_membership.py @@ -78,7 +78,8 @@ def _invoice_membership(self, cr, uid, data, context): 'partner_id' : partner_id, 'address_invoice_id': partner_address_ids[partner_id]['id'], 'account_id': account_id, - 'invoice_line':[(6,0,[invoice_line_id])] + 'invoice_line':[(6,0,[invoice_line_id])], + 'fiscal_position': fpos_id or False } ) invoice_list.append(invoice_id) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index eb9fe390bd9..985af84118f 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -281,6 +281,7 @@ class mrp_repair(osv.osv): 'address_invoice_id': repair.address_id.id, 'currency_id': repair.pricelist_id.currency_id.id, 'comment': repair.quotation_notes, + 'fiscal_position': repair.partner_id.property_account_position.id } inv_obj = self.pool.get('account.invoice') inv_id = inv_obj.create(cr, uid, inv) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 63051813ec0..8ba37697c8f 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -306,7 +306,7 @@ class purchase_order(osv.osv): a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a) il.append(self.inv_line_create(a,ol)) - a = o.partner_id.property_account_payable.id + a = o.partner_id.property_account_payable.id journal_ids = journal_obj.search(cr, uid, [('type', '=','purchase')], limit=1) inv = { 'name': o.partner_ref or o.name, @@ -320,6 +320,7 @@ class purchase_order(osv.osv): 'journal_id': len(journal_ids) and journal_ids[0] or False, 'origin': o.name, 'invoice_line': il, + 'fiscal_position': o.partner_id.property_account_position.id } inv_id = self.pool.get('account.invoice').create(cr, uid, inv, {'type':'in_invoice'}) self.pool.get('account.invoice').button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, set_total=True) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 735c6bb9325..6e635b96be2 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -372,6 +372,7 @@ class sale_order(osv.osv): 'currency_id' : order.pricelist_id.currency_id.id, 'comment': order.note, 'payment_term': pay_term, + 'fiscal_position': order.partner_id.property_account_position.id } inv_obj = self.pool.get('account.invoice') inv.update(self._inv_get(cr, uid, order)) diff --git a/addons/sale/wizard/make_invoice_advance.py b/addons/sale/wizard/make_invoice_advance.py index b2328ed3342..95b4fde05f3 100644 --- a/addons/sale/wizard/make_invoice_advance.py +++ b/addons/sale/wizard/make_invoice_advance.py @@ -87,6 +87,7 @@ def _createInvoices(self, cr, uid, data, context={}): 'currency_id' :sale.pricelist_id.currency_id.id, 'comment': '', 'payment_term':sale.payment_term.id, + 'fiscal_position': sale.partner_id.property_account_position.id } inv_obj = pool_obj.get('account.invoice') inv_id = inv_obj.create(cr, uid, inv) diff --git a/addons/sale/wizard/wizard_sale_line_invoice.py b/addons/sale/wizard/wizard_sale_line_invoice.py index b3c1f718b79..b75dff690a4 100644 --- a/addons/sale/wizard/wizard_sale_line_invoice.py +++ b/addons/sale/wizard/wizard_sale_line_invoice.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$ # @@ -61,6 +61,7 @@ def _makeInvoices(self, cr, uid, data, context): 'currency_id' : order.pricelist_id.currency_id.id, 'comment': order.note, 'payment_term': pay_term, + 'fiscal_position': order.partner_id.property_account_position.id } inv_id = pool.get('account.invoice').create(cr, uid, inv) return inv_id diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 92fa50dbd0b..197b3eb15e5 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -84,8 +84,8 @@ class stock_location(osv.osv): if 'stock_virtual' in field_names: res[loc]['stock_virtual'] = prod.virtual_available return res - - + + def product_detail(self, cr, uid, id, field): res = {} res[id] = {} @@ -100,7 +100,7 @@ class stock_location(osv.osv): product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read,'standard_price','name']) final_value += (product[field_to_read] * product['standard_price']) return final_value - + def _product_value(self, cr, uid, ids, field_names, arg, context={}): result = {} for id in ids: @@ -110,7 +110,7 @@ class stock_location(osv.osv): ret_dict = self.product_detail(cr,uid,loc,field=field_name) result[loc][field_name] = ret_dict return result - + _columns = { 'name': fields.char('Location Name', size=64, required=True, translate=True), 'active': fields.boolean('Active'), @@ -681,6 +681,7 @@ class stock_picking(osv.osv): 'address_contact_id': address_contact_id, 'comment': comment, 'payment_term': payment_term_id, + 'fiscal_position': partner.property_account_position.id } cur_id = self.get_currency_id(cursor, user, picking) if cur_id: