add fiscal position for the wizards(create invoice) for pos,sale,sale_crm
bzr revid: mra@tinyerp.com-20090130103724-1tkww39e0mwg0mwg
This commit is contained in:
parent
da5dbf5d55
commit
a24529399d
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -140,12 +140,12 @@ class account_invoice_line(osv.osv):
|
|||
else:
|
||||
return super(account_invoice_line, self).product_id_change_unit_price_inv(cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=context)
|
||||
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, price_type='tax_excluded', context=None):
|
||||
# note: will call product_id_change_unit_price_inv with context...
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, price_type='tax_excluded', context=None):
|
||||
# note: will call product_id_change_unit_price_inv with context...
|
||||
if context is None:
|
||||
context = {}
|
||||
context.update({'price_type': price_type})
|
||||
return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, context=context)
|
||||
return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, context=context)
|
||||
account_invoice_line()
|
||||
|
||||
class account_invoice_tax(osv.osv):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -55,7 +55,7 @@ class pos_order(osv.osv):
|
|||
def onchange_partner_pricelist(self, cr, uid, ids, part, context={}):
|
||||
if not part:
|
||||
return {}
|
||||
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
|
||||
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
|
||||
return {'value':{'pricelist_id': pricelist}}
|
||||
|
||||
def _amount_total(self, cr, uid, ids, field_name, arg, context):
|
||||
|
@ -521,7 +521,7 @@ class pos_order(osv.osv):
|
|||
inv_line.update(inv_line_ref.product_id_change(cr, uid, [],
|
||||
line.product_id.id,
|
||||
line.product_id.uom_id.id,
|
||||
line.qty, partner_id = order.partner_id.id)['value'])
|
||||
line.qty, partner_id = order.partner_id.id, fposition_id=order.partner_id.property_account_position.id)['value'])
|
||||
inv_line['price_unit'] = line.price_unit
|
||||
inv_line['discount'] = line.discount
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -61,7 +61,7 @@ def _createInvoices(self, cr, uid, data, context={}):
|
|||
raise osv.except_osv(
|
||||
_('Error'),
|
||||
_("You cannot make an advance on a sale order that is defined as 'Automatic Invoice after delivery'."))
|
||||
val = obj_lines.product_id_change(cr, uid, [], data['form']['product_id'],uom = False, partner_id = sale.partner_id.id)
|
||||
val = obj_lines.product_id_change(cr, uid, [], data['form']['product_id'],uom = False, partner_id = sale.partner_id.id, fposition_id=sale.fiscal_position.id)
|
||||
line_id =obj_lines.create(cr, uid, {
|
||||
'name': val['value']['name'],
|
||||
'account_id':val['value']['account_id'],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -72,21 +72,22 @@ class make_sale(wizard.interface):
|
|||
['invoice', 'delivery', 'contact'])
|
||||
default_pricelist = partner_obj.browse(cr, uid, data['form']['partner_id'],
|
||||
context).property_product_pricelist.id
|
||||
|
||||
fpos_data = partner_obj.browse(cr, uid, data['form']['partner_id'],context).property_account_position
|
||||
new_ids = []
|
||||
|
||||
for case in case_obj.browse(cr, uid, data['ids']):
|
||||
if case.partner_id and case.partner_id.id:
|
||||
partner_id = case.partner_id.id
|
||||
fpos = case.partner_id.property_account_position and case.partner_id.property_account_position.id or False
|
||||
partner_addr = partner_obj.address_get(cr, uid, [case.partner_id.id],
|
||||
['invoice', 'delivery', 'contact'])
|
||||
pricelist = partner_obj.browse(cr, uid, case.partner_id.id,
|
||||
context).property_product_pricelist.id
|
||||
else:
|
||||
partner_id = data['form']['partner_id']
|
||||
fpos = fpos_data and fpos_data.id or False
|
||||
partner_addr = default_partner_addr
|
||||
pricelist = default_pricelist
|
||||
|
||||
vals = {
|
||||
'origin': 'CRM:%s' % str(case.id),
|
||||
'picking_policy': data['form']['picking_policy'],
|
||||
|
@ -102,10 +103,9 @@ class make_sale(wizard.interface):
|
|||
if data['form']['analytic_account']:
|
||||
vals['project_id'] = data['form']['analytic_account']
|
||||
new_id = sale_obj.create(cr, uid, vals)
|
||||
|
||||
for product_id in data['form']['products'][0][2]:
|
||||
value = sale_line_obj.product_id_change(cr, uid, [], pricelist,
|
||||
product_id, qty=1, partner_id=partner_id)['value']
|
||||
product_id, qty=1, partner_id=partner_id, fiscal_position=fpos)['value']
|
||||
value['product_id'] = product_id
|
||||
value['order_id'] = new_id
|
||||
sale_line_obj.create(cr, uid, value)
|
||||
|
|
Loading…
Reference in New Issue