diff options
Diffstat (limited to 'addons/purchase')
| -rw-r--r-- | addons/purchase/partner.py | 13 | ||||
| -rw-r--r-- | addons/purchase/partner_view.xml | 9 | ||||
| -rw-r--r-- | addons/purchase/purchase.py | 139 | ||||
| -rw-r--r-- | addons/purchase/purchase_data.xml | 25 | ||||
| -rw-r--r-- | addons/purchase/purchase_view.xml | 57 | ||||
| -rw-r--r-- | addons/purchase/report/purchase_report.py | 4 | ||||
| -rw-r--r-- | addons/purchase/res_config.py | 7 | ||||
| -rw-r--r-- | addons/purchase/res_config_view.xml | 1 | ||||
| -rw-r--r-- | addons/purchase/security/ir.model.access.csv | 6 | ||||
| -rw-r--r-- | addons/purchase/stock.py | 35 | ||||
| -rw-r--r-- | addons/purchase/test/anglo_saxon.yml | 1 | ||||
| -rw-r--r-- | addons/purchase/test/anglo_saxon_avg_fifo.yml | 1 | ||||
| -rw-r--r-- | addons/purchase/test/average_price.yml | 3 | ||||
| -rw-r--r-- | addons/purchase/test/costmethodchange.yml | 3 | ||||
| -rw-r--r-- | addons/purchase/test/fifo_price.yml | 45 | ||||
| -rw-r--r-- | addons/purchase/test/fifo_returns.yml | 2 | ||||
| -rw-r--r-- | addons/purchase/test/process/merge_order.yml | 1 | ||||
| -rw-r--r-- | addons/purchase/tests/test_onchange_product_id.py | 2 | ||||
| -rw-r--r-- | addons/purchase/tests/test_purchase_to_invoice.py | 3 |
19 files changed, 90 insertions, 267 deletions
diff --git a/addons/purchase/partner.py b/addons/purchase/partner.py index 934a0f56b22..86aa671dd5b 100644 --- a/addons/purchase/partner.py +++ b/addons/purchase/partner.py @@ -19,15 +19,14 @@ class res_partner(osv.osv): } def _commercial_fields(self, cr, uid, context=None): - return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_product_pricelist_purchase'] + return super(res_partner, self)._commercial_fields(cr, uid, context=context) _columns = { - 'property_product_pricelist_purchase': fields.property( - type='many2one', - relation='product.pricelist', - domain=[('type','=','purchase')], - string="Purchase Pricelist", - help="This pricelist will be used, instead of the default one, for purchases from the current partner"), + 'property_purchase_currency_id': fields.property( + type='many2one', + relation='res.currency', + string="Supplier Currency", + help="This currency will be used, instead of the default one, for purchases from the current partner"), 'purchase_order_count': fields.function(_purchase_invoice_count, string='# of Purchase Order', type='integer', multi="count"), 'supplier_invoice_count': fields.function(_purchase_invoice_count, string='# Vendor Bills', type='integer', multi="count"), } diff --git a/addons/purchase/partner_view.xml b/addons/purchase/partner_view.xml index a724d5e029f..ab0d3c3456c 100644 --- a/addons/purchase/partner_view.xml +++ b/addons/purchase/partner_view.xml @@ -1,19 +1,18 @@ <openerp> <data> - <record id="view_partner_property_form" model="ir.ui.view"> + <record id="view_partner_property_form" model="ir.ui.view"> <field name="name">res.partner.purchase.property.form.inherit</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/> <field name="priority">36</field> - <field name="groups_id" eval="[(4, ref('product.group_purchase_pricelist'))]"/> + <field name="groups_id" eval="[(4, ref('base.group_multi_currency'))]"/> <field name="arch" type="xml"> <group name="purchase" position="inside"> - <field name="property_product_pricelist_purchase"/> + <field name="property_purchase_currency_id"/> </group> </field> - </record> - + </record> <record id="act_res_partner_2_purchase_order" model="ir.actions.act_window"> <field name="name">RFQs and Purchases</field> <field name="res_model">purchase.order</field> diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index fbc1714fac5..b523a4593f3 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -3,6 +3,7 @@ from openerp import SUPERUSER_ID, workflow from datetime import datetime +import time from dateutil.relativedelta import relativedelta from operator import attrgetter from openerp.osv import fields, osv @@ -26,7 +27,7 @@ class purchase_order(osv.osv): 'amount_total': 0.0, } val = val1 = 0.0 - cur = order.pricelist_id.currency_id + cur = order.currency_id for line in order.order_line: line_price = line_obj._calc_line_base_price(cr, uid, line, context=context) @@ -226,7 +227,6 @@ class purchase_order(osv.osv): "Otherwise, keep empty to deliver to your own company." ), 'location_id': fields.many2one('stock.location', 'Destination', required=True, domain=[('usage','<>','view')], states=READONLY_STATES), - 'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states=READONLY_STATES, help="The pricelist sets the currency used for this purchase order. It also computes the vendor price for the selected products/quantities."), 'currency_id': fields.many2one('res.currency','Currency', required=True, states=READONLY_STATES), 'state': fields.selection(STATE_SELECTION, 'Status', readonly=True, help="The status of the purchase order or the quotation request. " @@ -302,7 +302,6 @@ class purchase_order(osv.osv): 'shipped': 0, 'invoice_method': 'order', 'invoiced': 0, - 'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist_purchase.id, 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c), 'journal_id': _get_journal, 'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id, @@ -364,11 +363,6 @@ class purchase_order(osv.osv): def button_dummy(self, cr, uid, ids, context=None): return True - def onchange_pricelist(self, cr, uid, ids, pricelist_id, context=None): - if not pricelist_id: - return {} - return {'value': {'currency_id': self.pool.get('product.pricelist').browse(cr, uid, pricelist_id, context=context).currency_id.id}} - #Destination address is used when dropshipping def onchange_dest_address_id(self, cr, uid, ids, address_id, context=None): if not address_id: @@ -396,6 +390,7 @@ class purchase_order(osv.osv): return {'value': { 'fiscal_position_id': False, 'payment_term_id': False, + 'currency_id': self.pool['res.users'].browse(cr, uid, uid, context=context).company_id.currency_id.id, }} company_id = self.pool.get('res.users')._get_company(cr, uid, context=context) @@ -404,9 +399,9 @@ class purchase_order(osv.osv): fp = self.pool['account.fiscal.position'].get_fiscal_position(cr, uid, company_id, partner_id, context=context) supplier = partner.browse(cr, uid, partner_id, context=context) return {'value': { - 'pricelist_id': supplier.property_product_pricelist_purchase.id, 'fiscal_position_id': fp or supplier.property_account_position_id and supplier.property_account_position_id.id or False, 'payment_term_id': supplier.property_supplier_payment_term_id.id or False, + 'currency_id': supplier.property_purchase_currency_id.id or self.pool['res.users'].browse(cr, uid, uid, context=context).company_id.currency_id.id }} def invoice_open(self, cr, uid, ids, context=None): @@ -941,7 +936,7 @@ class purchase_order(osv.osv): order_lines_to_move = {} for porder in [order for order in self.browse(cr, uid, ids, context=context) if order.state == 'draft']: - order_key = make_key(porder, ('partner_id', 'location_id', 'pricelist_id', 'currency_id')) + order_key = make_key(porder, ('partner_id', 'location_id', 'currency_id')) new_order = new_orders.setdefault(order_key, ({}, [])) new_order[1].append(porder.id) order_infos = new_order[0] @@ -955,7 +950,6 @@ class purchase_order(osv.osv): 'dest_address_id': porder.dest_address_id.id, 'picking_type_id': porder.picking_type_id.id, 'location_id': porder.location_id.id, - 'pricelist_id': porder.pricelist_id.id, 'currency_id': porder.currency_id.id, 'state': 'draft', 'order_line': {}, @@ -1050,7 +1044,7 @@ class purchase_order_line(osv.osv): context=context) line_qty = self._calc_line_quantity(cr, uid, line, context=context) - cur = line.order_id.pricelist_id.currency_id + cur = line.order_id.currency_id taxes = line.taxes_id.compute_all(line_price, cur, line_qty, line.product_id, line.order_id.partner_id) @@ -1115,9 +1109,9 @@ class purchase_order_line(osv.osv): procurement_obj.write(cr, uid, procurement_ids_to_except, {'state': 'exception'}, context=context) return super(purchase_order_line, self).unlink(cr, uid, ids, context=context) - def onchange_product_uom(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, + def onchange_product_uom(self, cr, uid, ids, product_id, qty, uom_id, partner_id, date_order=False, fiscal_position_id=False, date_planned=False, - name=False, price_unit=False, state='draft', context=None): + name=False, price_unit=False, state='draft', currency_id=False, context=None): """ onchange handler of product_uom. """ @@ -1126,23 +1120,23 @@ class purchase_order_line(osv.osv): if not uom_id: return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'product_uom' : uom_id or False}} context = dict(context, purchase_uom_check=True) - return self.onchange_product_id(cr, uid, ids, pricelist_id, product_id, qty, uom_id, + return self.onchange_product_id(cr, uid, ids, product_id, qty, uom_id, partner_id, date_order=date_order, fiscal_position_id=fiscal_position_id, date_planned=date_planned, - name=name, price_unit=price_unit, state=state, replace=False, context=context) + name=name, price_unit=price_unit, state=state, replace=False, currency_id=currency_id, context=context) - def _get_date_planned(self, cr, uid, supplier_info, date_order_str, context=None): + def _get_date_planned(self, cr, uid, product, date_order_str, context=None): """Return the datetime value to use as Schedule Date (``date_planned``) for PO Lines that correspond to the given product.supplierinfo, when ordered at `date_order_str`. - :param browse_record | False supplier_info: product.supplierinfo, used to - determine delivery delay (if False, default delay = 0) + :param browse_record | False product: product.product, used to + determine delivery delay thanks to the selected seller field (if False, default delay = 0) :param str date_order_str: date of order field, as a string in DEFAULT_SERVER_DATETIME_FORMAT :rtype: datetime :return: desired Schedule Date for the PO line """ - supplier_delay = int(supplier_info.delay) if supplier_info else 0 + supplier_delay = int(product.seller_delay) if product else 0 return datetime.strptime(date_order_str, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=supplier_delay) def action_cancel(self, cr, uid, ids, context=None): @@ -1158,26 +1152,23 @@ class purchase_order_line(osv.osv): res = [user for user in group_uom.users if user.id == uid] return len(res) and True or False - def onchange_product_id(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, + def onchange_product_id(self, cr, uid, ids, product_id, qty, uom_id, partner_id, date_order=False, fiscal_position_id=False, date_planned=False, - name=False, price_unit=False, state='draft', replace=True, context=None): + name=False, price_unit=False, state='draft', replace=True, currency_id=False, context=None): """ onchange handler of product_id. """ if context is None: context = {} - res = {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'product_uom' : uom_id or False}} if not product_id: if not uom_id: uom_id = self.default_get(cr, uid, ['product_uom'], context=context).get('product_uom', False) res['value']['product_uom'] = uom_id return res - product_product = self.pool.get('product.product') product_uom = self.pool.get('product.uom') res_partner = self.pool.get('res.partner') - product_pricelist = self.pool.get('product.pricelist') account_fiscal_position = self.pool.get('account.fiscal.position') account_tax = self.pool.get('account.tax') @@ -1189,10 +1180,14 @@ class purchase_order_line(osv.osv): # - determine name and notes based on product in partner lang. context_partner = context.copy() + context_partner.update({'partner': partner_id, 'quantity': qty}) if partner_id: lang = res_partner.browse(cr, uid, partner_id).lang - context_partner.update( {'lang': lang, 'partner_id': partner_id} ) + context_partner.update({'lang': lang, 'partner_id': partner_id}) product = product_product.browse(cr, uid, product_id, context=context_partner) + price = product.seller_price + if product.selected_seller_id.currency_id.id != currency_id: + price = self.pool['res.currency'].compute(cr, uid, product.selected_seller_id.currency_id.id, currency_id, price, context=dict(context or {}, date=date_order)) if replace: #call name_get() with partner in the context to eventually match name and description in the seller_ids field dummy, name = product_product.name_get(cr, uid, product_id, context=context_partner)[0] @@ -1208,7 +1203,8 @@ class purchase_order_line(osv.osv): if not uom_id: uom_id = product_uom_po_id - if product.uom_id.category_id.id != product_uom.browse(cr, uid, uom_id, context=context).category_id.id: + uom = product_uom.browse(cr, uid, uom_id, context=context) + if product.uom_id.category_id.id != uom.category_id.id: if context.get('purchase_uom_check') and self._check_product_uom_group(cr, uid, context=context): res['warning'] = {'title': _('Warning!'), 'message': _('Selected Unit of Measure does not belong to the same category as the product Unit of Measure.')} uom_id = product_uom_po_id @@ -1218,46 +1214,21 @@ class purchase_order_line(osv.osv): # - determine product_qty and date_planned based on seller info if not date_order: date_order = fields.datetime.now() - - - supplierinfo = False - precision = self.pool.get('decimal.precision').precision_get(cr, uid, 'Product Unit of Measure') - for supplier in product.seller_ids: - if partner_id and (supplier.name.id == partner_id): - supplierinfo = supplier - if supplierinfo.product_uom.id != uom_id: - res['warning'] = {'title': _('Warning!'), 'message': _('The selected supplier only sells this product by %s') % supplierinfo.product_uom.name } - min_qty = product_uom._compute_qty(cr, uid, supplierinfo.product_uom.id, supplierinfo.min_qty, to_uom_id=uom_id) - if float_compare(min_qty , qty, precision_digits=precision) == 1: # If the supplier quantity is greater than entered from user, set minimal. - if qty: - res['warning'] = {'title': _('Warning!'), 'message': _('The selected vendor has a minimal quantity set to %s %s, you should not purchase less.') % (supplierinfo.min_qty, supplierinfo.product_uom.name)} - qty = min_qty - dt = self._get_date_planned(cr, uid, supplierinfo, date_order, context=context).strftime(DEFAULT_SERVER_DATETIME_FORMAT) + dt = self._get_date_planned(cr, uid, product, date_order, context=context).strftime(DEFAULT_SERVER_DATETIME_FORMAT) qty = qty or 1.0 res['value'].update({'date_planned': date_planned or dt}) if qty: res['value'].update({'product_qty': qty}) - price = price_unit - if price_unit is False or price_unit is None: - # - determine price_unit and taxes_id - if pricelist_id: - date_order_str = datetime.strptime(date_order, DEFAULT_SERVER_DATETIME_FORMAT).strftime(DEFAULT_SERVER_DATE_FORMAT) - price = product_pricelist.price_get(cr, uid, [pricelist_id], - product.id, qty or 1.0, partner_id or False, {'uom': uom_id, 'date': date_order_str})[pricelist_id] - else: - price = product.standard_price - taxes = account_tax.browse(cr, uid, map(lambda x: x.id, product.supplier_taxes_id)) fpos = fiscal_position_id and account_fiscal_position.browse(cr, uid, fiscal_position_id, context=context) or False taxes_ids = account_fiscal_position.map_tax(cr, uid, fpos, taxes) price = self.pool['account.tax']._fix_tax_included_price(cr, uid, price, product.supplier_taxes_id, taxes_ids) res['value'].update({'price_unit': price, 'taxes_id': taxes_ids}) - return res product_id_change = onchange_product_id - product_uom_change = onchange_product_uom + product_uom_change = onchange_product_uom def action_confirm(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'confirmed'}, context=context) @@ -1281,7 +1252,6 @@ class procurement_order(osv.osv): def propagate_cancels(self, cr, uid, ids, context=None): purchase_line_obj = self.pool.get('purchase.order.line') lines_to_cancel = [] - uom_obj = self.pool.get("product.uom") for procurement in self.browse(cr, uid, ids, context=context): if procurement.rule_id.action == 'buy' and procurement.purchase_line_id: if procurement.purchase_line_id.state not in ('draft', 'cancel'): @@ -1420,24 +1390,8 @@ class procurement_order(osv.osv): res = {} if context is None: context = {} - uom_obj = self.pool.get('product.uom') - pricelist_obj = self.pool.get('product.pricelist') prod_obj = self.pool.get('product.product') acc_pos_obj = self.pool.get('account.fiscal.position') - - pricelist_id = partner.property_product_pricelist_purchase.id - prices_qty = [] - qty = {} - - for procurement in procurements: - seller_qty = procurement.product_id.seller_qty if procurement.location_id.usage != 'customer' else 0.0 - uom_id = procurement.product_id.uom_po_id.id - qty[procurement.product_id.id] = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id) - if seller_qty: - qty[procurement.product_id.id] = max(qty[procurement.product_id.id], seller_qty) - prices_qty += [(procurement.product_id, qty[procurement.product_id.id], partner)] - prices = pricelist_obj.price_get_multi(cr, uid, [pricelist_id], prices_qty) - #Passing partner_id to context for purchase order line integrity of Line name new_context = context.copy() new_context.update({'lang': partner.lang, 'partner_id': partner.id}) @@ -1455,26 +1409,31 @@ class procurement_order(osv.osv): name = names_dict[procurement.product_id.id] if procurement.product_id.description_purchase: name += '\n' + procurement.product_id.description_purchase - price = prices[procurement.product_id.id][pricelist_id] - price = uom_obj._compute_price(cr, uid, procurement.product_uom.id, price, to_uom_id=procurement.product_id.product_tmpl_id.uom_po_id.id) - + date = schedule_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT) values = { 'name': name, - 'product_qty': qty[procurement.product_id.id], 'product_id': procurement.product_id.id, 'product_uom': procurement.product_id.uom_po_id.id, - 'price_unit': price or 0.0, - 'date_planned': schedule_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT), + 'date_planned': date, 'taxes_id': [(6, 0, taxes)], 'procurement_ids': [(4, procurement.id)] } + # calculate price/qty for valid vendor + qty = self.pool['product.uom']._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, procurement.product_id.uom_po_id.id) + new_context.update({'quantity': qty}) + supplier = prod_obj.browse(cr, uid, procurement.product_id.id, context=new_context).selected_seller_id + price = 0.0 + if supplier: + price = supplier.price + purchase_currency = supplier.name.property_purchase_currency_id + price = self.pool['res.currency'].compute(cr, uid, supplier.currency_id.id, purchase_currency.id, price, context=dict(context or {}, date=date)) + values.update({'product_qty': qty, 'price_unit': price}) res[procurement.id] = values return res def _calc_new_qty_price(self, cr, uid, procurement, po_line=None, cancel=False, context=None): if not po_line: po_line = procurement.purchase_line_id - uom_obj = self.pool.get('product.uom') qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, procurement.product_id.uom_po_id.id) @@ -1490,8 +1449,9 @@ class procurement_order(osv.osv): else: supplierinfo_obj = self.pool.get('product.supplierinfo') supplierinfo_ids = supplierinfo_obj.search(cr, uid, [('name', '=', po_line.order_id.partner_id.id), ('product_tmpl_id', '=', po_line.product_id.product_tmpl_id.id)]) - supplierinfo_min_qty = supplierinfo_obj.browse(cr, uid, supplierinfo_ids).min_qty - + if supplierinfo_ids: + supplierinfo = supplierinfo_obj.browse(cr, uid, supplierinfo_ids) + supplierinfo_min_qty = sorted(supplierinfo, key=lambda x: x['min_qty'])[0].min_qty if supplierinfo_min_qty == 0.0: qty += po_line.product_qty else: @@ -1503,10 +1463,8 @@ class procurement_order(osv.osv): price = po_line.price_unit if qty != po_line.product_qty: - pricelist_obj = self.pool.get('product.pricelist') - pricelist_id = po_line.order_id.partner_id.property_product_pricelist_purchase.id - price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, po_line.order_id.partner_id.id, {'uom': procurement.product_uom.id})[pricelist_id] - + price = po_line.product_id.seller_price + price = self.pool['product.uom']._compute_price(cr, uid, procurement.product_uom.id, price, procurement.product_uom.id) return qty, price def update_origin_po(self, cr, uid, po, proc, context=None): @@ -1514,7 +1472,7 @@ class procurement_order(osv.osv): def _get_grouping_dicts(self, cr, uid, ids, context=None): """ - It will group the procurements according to the pos they should go into. That way, lines going to the same + It will group the procurements according to the pos they should go into. That way, lines going to the same po, can be processed at once. Returns two dictionaries: add_purchase_dicts: key: po value: procs to add to the po @@ -1522,20 +1480,21 @@ class procurement_order(osv.osv): values: procs to add """ po_obj = self.pool.get('purchase.order') + date = time.strftime(DEFAULT_SERVER_DATE_FORMAT) # Regroup POs cr.execute(""" SELECT psi.name, p.id, pr.id, pr.picking_type_id, p.location_id, p.partner_dest_id, p.company_id, p.group_id, - pr.group_propagation_option, pr.group_id, psi.qty + pr.group_propagation_option, pr.group_id,psi.qty FROM procurement_order AS p LEFT JOIN procurement_rule AS pr ON pr.id = p.rule_id LEFT JOIN procurement_group AS pg ON p.group_id = pg.id, product_supplierinfo AS psi, product_product AS pp WHERE p.product_id = pp.id AND p.id in %s AND psi.product_tmpl_id = pp.product_tmpl_id - AND (psi.company_id = p.company_id or psi.company_id IS NULL) + AND (psi.company_id = p.company_id or psi.company_id IS NULL) AND ((psi.date_start IS NULL OR psi.date_start<=%s) AND (psi.date_end IS NULL OR psi.date_end>=%s)) ORDER BY psi.sequence, psi.name, p.rule_id, p.location_id, p.company_id, p.partner_dest_id, p.group_id - """, (tuple(ids), )) + """, (tuple(ids), date, date)) res = cr.fetchall() old = False # A giant dict for grouping lines, ... to do at once @@ -1609,8 +1568,6 @@ class procurement_order(osv.osv): else: procs_to_create.append(proc) - procs = [] - # FIXME: these are not real tracking values, it should be fixed if tracking values for one2many # are managed def format_message(message_description, tracked_values): @@ -1674,9 +1631,9 @@ class procurement_order(osv.osv): 'partner_id': create_purchase[0], 'location_id': procurement.location_id.id, 'picking_type_id': procurement.rule_id.picking_type_id.id, - 'pricelist_id': partner.property_product_pricelist_purchase.id, 'date_order': purchase_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT), 'company_id': procurement.company_id.id, + 'currency_id': partner.property_purchase_currency_id.id or self.pool['res.users'].browse(cr, uid, uid, context=context).company_id.currency_id.id, 'fiscal_position_id': fp, 'payment_term_id': partner.property_supplier_payment_term_id.id, 'dest_address_id': procurement.partner_dest_id.id, diff --git a/addons/purchase/purchase_data.xml b/addons/purchase/purchase_data.xml index c13d4620361..092e3a782d2 100644 --- a/addons/purchase/purchase_data.xml +++ b/addons/purchase/purchase_data.xml @@ -17,31 +17,6 @@ <field name="name">Purchase Order</field> <field name="object">purchase.order</field> </record> - - <record id="pricelist_type_purchase" model="product.pricelist.type"> - <field name="name">Purchase Pricelist</field> - <field name="key">purchase</field> - </record> - - <record id="list0" model="product.pricelist"> - <field name="name">Default Purchase Pricelist</field> - <field name="type">purchase</field> - </record> - <record id="ver0" model="product.pricelist.version"> - <field name="pricelist_id" ref="list0"/> - <field name="name">Default Purchase Pricelist Version</field> - </record> - <record id="item0" model="product.pricelist.item"> - <field name="price_version_id" ref="ver0"/> - <field name="base" ref="product.standard_price"/> - <field name="name">Default Purchase Pricelist Line</field> - </record> - - <record forcecreate="True" id="property_product_pricelist_purchase" model="ir.property"> - <field name="name">property_product_pricelist_purchase</field> - <field name="fields_id" search="[('model','=','res.partner'),('name','=','property_product_pricelist_purchase')]"/> - <field eval="'product.pricelist,'+str(list0)" name="value"/> - </record> <!-- Purchase-related subtypes for messaging / Chatter --> <record id="mt_rfq_confirmed" model="mail.message.subtype"> diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index e11e5fea483..6dbd7d6ab72 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -13,44 +13,16 @@ <menuitem id="menu_procurement_management" name="Purchase" parent="base.menu_purchase_root" sequence="1" /> - <record id="purchase_pricelist_version_action" model="ir.actions.act_window"> - <field name="name">Pricelist Versions</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">product.pricelist.version</field> - <field name="view_type">form</field> - <field name="view_id" ref="product.product_pricelist_version_tree_view"/> - <field name="domain">[('pricelist_id.type','=','purchase')]</field> - <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to add a pricelist version. - </p><p> - There can be more than one version of a pricelist, each of - these must be valid during a certain period of time. Some - examples of versions: Main Prices, 2010, 2011, Summer Sales, - etc. - </p> - </field> - </record> <menuitem id="menu_purchase_config" name="Configuration" parent="base.menu_purchase_root" sequence="100" groups="group_purchase_manager,base.group_configuration"/> + <menuitem id="menu_purchase_config_pricelist" name="Pricelists" - parent="menu_purchase_config" sequence="50" groups="product.group_purchase_pricelist"/> - <menuitem - action="product.product_pricelist_action_for_purchase" id="menu_product_pricelist_action2_purchase" - parent="menu_purchase_config_pricelist" sequence="1" groups="product.group_purchase_pricelist" /> - - <menuitem - action="product.product_pricelist_action_for_purchase" id="menu_product_pricelist_action2_purchase" - parent="menu_purchase_config_pricelist" sequence="1" groups="product.group_purchase_pricelist" /> - + parent="menu_purchase_config" sequence="20" groups="base.group_no_one"/> <menuitem - action="purchase_pricelist_version_action" id="menu_purchase_pricelist_version_action" - parent="menu_purchase_config_pricelist" sequence="2" groups="product.group_purchase_pricelist"/> + action="product.product_supplierinfo_type_action" id="menu_product_pricelist_action2_purchase" + parent="menu_purchase_config_pricelist" sequence="1" groups="base.group_no_one"/> <menuitem - action="product.product_price_type_action" id="menu_product_pricelist_action2_purchase_type" - parent="menu_purchase_config_pricelist" sequence="60" /> - <menuitem id="menu_product_in_config_purchase" name="Products" parent="menu_purchase_config" sequence="30" groups="base.group_no_one"/> @@ -215,7 +187,6 @@ <group> <field name="partner_id" on_change="onchange_partner_id(partner_id, context)" context="{'search_default_supplier':1, 'default_supplier':1, 'default_customer':0}" domain="[('supplier','=',True)]"/> <field name="partner_ref"/> - <field domain="[('type','=','purchase')]" name="pricelist_id" groups="product.group_purchase_pricelist" on_change="onchange_pricelist(pricelist_id, context)"/> <field name="currency_id" groups="base.group_multi_currency"/> <field name="journal_id" invisible='1'/> </group> @@ -237,19 +208,19 @@ <field name="order_line"> <tree string="Purchase Order Lines" editable="bottom"> <field name="product_id" - on_change="onchange_product_id(parent.pricelist_id, product_id, 0, False, + on_change="onchange_product_id(product_id, 0, False, parent.partner_id, parent.date_order, parent.fiscal_position_id, date_planned, - name, False, parent.state, True, context)" + name, False, parent.state, True, parent.currency_id,context)" context="{'partner_id': parent.partner_id}"/> <field name="name"/> <field name="date_planned"/> <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/> <field name="account_analytic_id" context="{'default_partner_id':parent.partner_id}" groups="purchase.group_analytic_accounting" domain="[('type','not in',('view','template'))]"/> <field name="product_qty" - on_change="onchange_product_id(parent.pricelist_id, product_id, product_qty, + on_change="onchange_product_id(product_id, product_qty, product_uom, parent.partner_id, parent.date_order, parent.fiscal_position_id, - date_planned, name, False, parent.state, False, context)"/> - <field name="product_uom" groups="product.group_uom" on_change="onchange_product_uom(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position_id,date_planned,name,False,parent.state,context)"/> + date_planned, name, False, parent.state, False, parent.currency_id, context)"/> + <field name="product_uom" groups="product.group_uom" on_change="onchange_product_uom(product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position_id,date_planned,name,False,parent.state,parent.currency_id,context)"/> <field name="price_unit"/> <field name="taxes_id" widget="many2many_tags" domain="[('type_tax_use','=','purchase')]"/> <field name="price_subtotal" widget="monetary"/> @@ -259,18 +230,18 @@ <group> <group> <field name="product_id" - on_change="onchange_product_id(parent.pricelist_id, product_id, 0, False, + on_change="onchange_product_id(product_id, 0, False, parent.partner_id, parent.date_order, parent.fiscal_position_id, date_planned, - name, False, parent.state, True, context)" + name, False, parent.state, True, parent.currency_id, context)" context="{'partner_id': parent.partner_id}"/> <label for="product_qty"/> <div> <field name="product_qty" class="oe_inline" - on_change="onchange_product_id(parent.pricelist_id, product_id, product_qty, + on_change="onchange_product_id(product_id, product_qty, product_uom, parent.partner_id, parent.date_order, parent.fiscal_position_id, - date_planned, name, False, parent.state, False, context)"/> + date_planned, name, False, parent.state, False, parent.currency_id, context)"/> <field name="product_uom" groups="product.group_uom" class="oe_inline" - on_change="onchange_product_uom(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position_id,date_planned,name,False,parent.state,context)"/> + on_change="onchange_product_uom(product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position_id,date_planned,name,False,parent.state,parent.currency_id,context)"/> </div> <field name="price_unit"/> </group> diff --git a/addons/purchase/report/purchase_report.py b/addons/purchase/report/purchase_report.py index 721d1b061ba..d8443d88db2 100644 --- a/addons/purchase/report/purchase_report.py +++ b/addons/purchase/report/purchase_report.py @@ -25,12 +25,12 @@ class purchase_report(osv.osv): 'picking_type_id': fields.many2one('stock.warehouse', 'Warehouse', readonly=True), 'location_id': fields.many2one('stock.location', 'Destination', readonly=True), 'partner_id':fields.many2one('res.partner', 'Vendor', readonly=True), - 'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', readonly=True), 'date_approve':fields.date('Date Approved', readonly=True), 'expected_date':fields.date('Expected Date', readonly=True), 'validator' : fields.many2one('res.users', 'Validated By', readonly=True), 'product_uom' : fields.many2one('product.uom', 'Reference Unit of Measure', required=True), 'company_id':fields.many2one('res.company', 'Company', readonly=True), + 'currency_id': fields.many2one('res.currency', 'Currency', readonly=True), 'user_id':fields.many2one('res.users', 'Responsible', readonly=True), 'delay':fields.float('Days to Validate', digits=(16,2), readonly=True), 'delay_pass':fields.float('Days to Deliver', digits=(16,2), readonly=True), @@ -68,7 +68,6 @@ class purchase_report(osv.osv): s.date_approve, s.minimum_planned_date as expected_date, s.dest_address_id, - s.pricelist_id, s.validator, spt.warehouse_id as picking_type_id, s.partner_id as partner_id, @@ -115,7 +114,6 @@ class purchase_report(osv.osv): l.date_planned, l.product_uom, s.minimum_planned_date, - s.pricelist_id, s.validator, s.dest_address_id, s.fiscal_position_id, diff --git a/addons/purchase/res_config.py b/addons/purchase/res_config.py index cf45fe70f56..5732ec807b0 100644 --- a/addons/purchase/res_config.py +++ b/addons/purchase/res_config.py @@ -20,13 +20,6 @@ class purchase_config_settings(osv.osv_memory): ('picking', 'Control vendor bill on incoming shipments'), ('order', 'Control vendor bill on a pregenerated draft invoice'), ], 'Default invoicing control method', required=True, default_model='purchase.order'), - 'group_purchase_pricelist':fields.selection([ - (0, 'Set a fixed cost price on each product'), - (1, 'Use pricelists to adapt your price per vendors or products') - ], "Pricelists", - implied_group='product.group_purchase_pricelist', - help='Allows to manage different prices based on rules per category of vendor.\n' - 'Example: 10% for retailers, promotion of 5 EUR on this product, etc.'), 'group_uom':fields.selection([ (0, 'Products have only one unit of measure (easier)'), (1, 'Some products may be sold/puchased in different unit of measures (advanced)') diff --git a/addons/purchase/res_config_view.xml b/addons/purchase/res_config_view.xml index 18d4ca546fe..3f767c0b349 100644 --- a/addons/purchase/res_config_view.xml +++ b/addons/purchase/res_config_view.xml @@ -30,7 +30,6 @@ </group> <group string="Purchase Order"> <field name="group_product_variant" widget="radio"/> - <field name="group_purchase_pricelist" widget="radio"/> <field name="group_uom" widget="radio"/> <field name="group_costing_method" widget="radio"/> <field name="module_purchase_double_validation" widget="radio"/> diff --git a/addons/purchase/security/ir.model.access.csv b/addons/purchase/security/ir.model.access.csv index 2eae4344025..d728f46acd8 100644 --- a/addons/purchase/security/ir.model.access.csv +++ b/addons/purchase/security/ir.model.access.csv @@ -41,13 +41,7 @@ access_product_category_purchase_manager,product.category purchase_manager,produ access_product_template_purchase_manager,product.template purchase_manager,product.model_product_template,purchase.group_purchase_manager,1,1,1,1
access_product_packaging_purchase_manager,product.packaging purchase_manager,product.model_product_packaging,purchase.group_purchase_manager,1,1,1,1
access_product_supplierinfo_purchase_manager,product.supplierinfo purchase_manager,product.model_product_supplierinfo,purchase.group_purchase_manager,1,1,1,1
-access_pricelist_partnerinfo_purchase_manager,pricelist.partnerinfo purchase_manager,product.model_pricelist_partnerinfo,purchase.group_purchase_manager,1,1,1,1
-access_product_price_type_purchase_manager,product.price.type purchase_manager,product.model_product_price_type,purchase.group_purchase_manager,1,1,1,1
-access_product_pricelist_type_purchase_manager,product.pricelist.type purchase_manager,product.model_product_pricelist_type,purchase.group_purchase_manager,1,1,1,1
-access_product_pricelist_purchase_manager,product.pricelist purchase_manager,product.model_product_pricelist,purchase.group_purchase_manager,1,1,1,1
-access_ir_property_group_purchase_manager,ir_property group_purchase_manager,base.model_ir_property,purchase.group_purchase_manager,1,1,1,1
access_product_group_res_partner_purchase_manager,res_partner group_purchase_manager,base.model_res_partner,purchase.group_purchase_manager,1,1,1,0
-access_product_pricelist_version_purchase_manager,product.pricelist.version purchase_manager,product.model_product_pricelist_version,purchase.group_purchase_manager,1,1,1,1
access_product_pricelist_item_purchase_manager,product.pricelist.item purchase_manager,product.model_product_pricelist_item,purchase.group_purchase_manager,1,1,1,1
access_account_account_purchase_manager,account.account purchase manager,account.model_account_account,purchase.group_purchase_manager,1,0,0,0
access_account_journal_purchase_manager,account.journal purchase manager,account.model_account_journal,purchase.group_purchase_manager,1,0,0,0
diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index 3397a99f37d..9a774dc5ba9 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -70,8 +70,8 @@ class stock_move(osv.osv): partner = move.picking_id and move.picking_id.partner_id or False code = self.get_code_from_locs(cr, uid, move, context=context) - if partner and partner.property_product_pricelist_purchase and code == 'incoming': - currency = partner.property_product_pricelist_purchase.currency_id.id + if partner and code == 'incoming': + currency = purchase_order.currency_id.id return partner, uid, currency return super(stock_move, self)._get_master_data(cr, uid, move, inv_type, context=context) @@ -105,35 +105,6 @@ class stock_move(osv.osv): extra_move_tax[0, move.product_id] = [(6, 0, res['value']['invoice_line_tax_ids'])] return (is_extra_move, extra_move_tax) - - def attribute_price(self, cr, uid, move, context=None): - """ - Attribute price to move, important in inter-company moves or receipts with only one partner - """ - # The method attribute_price of the parent class sets the price to the standard product - # price if move.price_unit is zero. We don't want this behavior in the case of a purchase - # order since we can purchase goods which are free of charge (e.g. 5 units offered if 100 - # are purchased). - if move.purchase_line_id: - return - - code = self.get_code_from_locs(cr, uid, move, context=context) - if not move.purchase_line_id and code == 'incoming' and not move.price_unit: - partner = move.picking_id and move.picking_id.partner_id or False - price = False - # If partner given, search price in its purchase pricelist - if partner and partner.property_product_pricelist_purchase: - pricelist_obj = self.pool.get("product.pricelist") - pricelist = partner.property_product_pricelist_purchase.id - price = pricelist_obj.price_get(cr, uid, [pricelist], - move.product_id.id, move.product_uom_qty, partner.id, { - 'uom': move.product_uom.id, - 'date': move.date, - })[pricelist] - if price: - return self.write(cr, uid, [move.id], {'price_unit': price}, context=context) - super(stock_move, self).attribute_price(cr, uid, move, context=context) - def _get_taxes(self, cr, uid, move, context=None): if move.origin_returned_move_id.purchase_line_id.taxes_id: return [tax.id for tax in move.origin_returned_move_id.purchase_line_id.taxes_id] @@ -141,7 +112,7 @@ class stock_move(osv.osv): class stock_picking(osv.osv): _inherit = 'stock.picking' - + def _get_to_invoice(self, cr, uid, ids, name, args, context=None): res = {} for picking in self.browse(cr, uid, ids, context=context): diff --git a/addons/purchase/test/anglo_saxon.yml b/addons/purchase/test/anglo_saxon.yml index 69aaba6feb2..72e16a0d47f 100644 --- a/addons/purchase/test/anglo_saxon.yml +++ b/addons/purchase/test/anglo_saxon.yml @@ -100,7 +100,6 @@ !record {model: purchase.order, id: purchase_order_001}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: 1 order_line: - product_id: product.product_product_10 product_qty: 1 diff --git a/addons/purchase/test/anglo_saxon_avg_fifo.yml b/addons/purchase/test/anglo_saxon_avg_fifo.yml index 8dcde204551..019605e0735 100644 --- a/addons/purchase/test/anglo_saxon_avg_fifo.yml +++ b/addons/purchase/test/anglo_saxon_avg_fifo.yml @@ -107,7 +107,6 @@ !record {model: purchase.order, id: purchase_order_001_fifo}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: 1 order_line: - product_id: product_fifo_anglo_saxon product_qty: 1 diff --git a/addons/purchase/test/average_price.yml b/addons/purchase/test/average_price.yml index f5bb97d95ac..b816e34bcbc 100644 --- a/addons/purchase/test/average_price.yml +++ b/addons/purchase/test/average_price.yml @@ -19,7 +19,6 @@ !record {model: purchase.order, id: purchase_order_average1}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: purchase.list0 order_line: - product_id: product_average_icecream product_qty: 10.0 @@ -54,7 +53,6 @@ !record {model: purchase.order, id: purchase_order_average2}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: purchase.list0 order_line: - product_id: product_average_icecream product_qty: 30.0 @@ -109,7 +107,6 @@ !record {model: purchase.order, id: purchase_order_average3}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: purchase.list0 order_line: - product_id: product_average_icecream product_qty: 500.0 diff --git a/addons/purchase/test/costmethodchange.yml b/addons/purchase/test/costmethodchange.yml index 7d6879cdc74..dccf5ee10c5 100644 --- a/addons/purchase/test/costmethodchange.yml +++ b/addons/purchase/test/costmethodchange.yml @@ -20,7 +20,6 @@ !record {model: purchase.order, id: purchase_order_variable1}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: 1 order_line: - product_id: product_variable_icecream product_qty: 10.0 @@ -33,7 +32,6 @@ !record {model: purchase.order, id: purchase_order_variable2}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: 1 order_line: - product_id: product_variable_icecream product_qty: 30.0 @@ -116,7 +114,6 @@ !record {model: purchase.order, id: purchase_order_variable3}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: 1 order_line: - product_id: product_variable_icecream product_qty: 20.0 diff --git a/addons/purchase/test/fifo_price.yml b/addons/purchase/test/fifo_price.yml index 7b4eba4a93b..05d87991489 100644 --- a/addons/purchase/test/fifo_price.yml +++ b/addons/purchase/test/fifo_price.yml @@ -4,9 +4,6 @@ !record {model: res.company, id: base.main_company}: currency_id: base.EUR - - !record {model: product.pricelist, id: purchase.list0}: - currency_id: base.EUR -- Set a product as using fifo price - !record {model: product.product, id: product_fifo_icecream}: @@ -28,8 +25,8 @@ - !record {model: purchase.order, id: purchase_order_fifo1}: partner_id: base.res_partner_3 + currency_id: base.EUR location_id: stock.stock_location_stock - pricelist_id: purchase.list0 order_line: - product_id: product_fifo_icecream product_qty: 10.0 @@ -62,7 +59,6 @@ !record {model: purchase.order, id: purchase_order_fifo2}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: purchase.list0 order_line: - product_id: product_fifo_icecream product_qty: 30.0 @@ -151,35 +147,20 @@ - We will temporarily change the currency rate on the sixth of June to have the same results all year - - !record {model: res.currency.rate, id: base.rateUSDbis}: - rate: 1.2834 - currency_id: base.USD - name: !eval time.strftime('%Y-06-06') -- - Create new pricelist in usd -- - !record {model: product.pricelist, id: supplier_pricelist_usd}: - name: Vendor Pricelist - type: purchase - currency_id: base.USD - version_id: - - name: v1.0 - items_id: - - name: First version - sequence: 1 - price_min_margin: 2 - price_max_margin: 5 - product_id: product_fifo_icecream - base: !eval (ref('product.standard_price')) -- - Purchase order in usd + Purchase order in USD +- + !record {model: res.currency, id: new_USD}: + name: new_usd + rate_ids: + - rate: 1.2834 + name: !eval time.strftime('%Y-%m-%d') - I create a draft Purchase Order for 30000 g at 0.150 USD/g and 10 kg at 150 USD/kg - !record {model: purchase.order, id: purchase_order_fifo_usd}: partner_id: base.res_partner_3 + currency_id: new_USD location_id: stock.stock_location_stock - pricelist_id: supplier_pricelist_usd order_line: - product_id: product_fifo_icecream product_qty: 30000 @@ -228,11 +209,11 @@ picking_obj = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_fifo_shipment_cur"), context=context) picking_obj.do_transfer() - - Check rounded price is 102 euro (because last outgoing shipment was made of 19.5kg at 80€ and 30kg at $150 (rate=1.2834) + Check rounded price is 102 euro (because last outgoing shipment was made of 19.5kg at 80€ and 30kg at $150 (rate=1.2834) - !python {model: product.product}: | assert round(self.browse(cr, uid, ref("product_fifo_icecream")).standard_price) == 102, "Product price not updated accordingly. %s found instead of 102 (rounded values)" %(round(self.browse(cr, uid, ref("product_fifo_icecream")).standard_price),) -- +- Do a delivery of an extra 10 kg - !record {model: stock.picking, id: outgoing_fifo_shipment_ret}: @@ -266,7 +247,7 @@ product = self.browse(cr, uid, ref("product_fifo_icecream")) assert round(product.standard_price) == round(150.0 / 1.2834), "Product price not updated accordingly. %s found instead of %s" %(product.standard_price, round(150.0/1.2834)) assert product.qty_available == 0.0, 'Wrong quantity in stock after first reception' -- +- Let us create some outs to get negative stock for a new product using the same config - !record {model: product.product, id: product_fifo_negative}: @@ -340,7 +321,6 @@ !record {model: purchase.order, id: purchase_order_fifo_neg}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: purchase.list0 order_line: - product_id: product_fifo_negative product_qty: 50.0 @@ -369,7 +349,6 @@ !record {model: purchase.order, id: purchase_order_fifo_neg2}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: purchase.list0 order_line: - product_id: product_fifo_negative product_qty: 60.0 diff --git a/addons/purchase/test/fifo_returns.yml b/addons/purchase/test/fifo_returns.yml index 6be83f0f8bf..77ba3984715 100644 --- a/addons/purchase/test/fifo_returns.yml +++ b/addons/purchase/test/fifo_returns.yml @@ -20,7 +20,6 @@ !record {model: purchase.order, id: purchase_order_fiforet1}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: purchase.list0 order_line: - product_id: product_fiforet_icecream product_qty: 10.0 @@ -33,7 +32,6 @@ !record {model: purchase.order, id: purchase_order_fiforet2}: partner_id: base.res_partner_3 location_id: stock.stock_location_stock - pricelist_id: purchase.list0 order_line: - product_id: product_fiforet_icecream product_qty: 30.0 diff --git a/addons/purchase/test/process/merge_order.yml b/addons/purchase/test/process/merge_order.yml index bbb84b0507f..591556a6981 100644 --- a/addons/purchase/test/process/merge_order.yml +++ b/addons/purchase/test/process/merge_order.yml @@ -29,7 +29,6 @@ for order in self.browse(cr, uid, new_id.keys()): assert order.state == 'draft',"New created order state should be in draft" assert order.partner_id == order3.partner_id ,"partner is not correspond" - assert order.pricelist_id == order3.pricelist_id,"Price list is not correspond" assert order.location_id == order3.location_id ,"Location is not correspond" total_new_qty = sum(x.product_qty for x in order.order_line) diff --git a/addons/purchase/tests/test_onchange_product_id.py b/addons/purchase/tests/test_onchange_product_id.py index 10ed1f01f81..b0778db6306 100644 --- a/addons/purchase/tests/test_onchange_product_id.py +++ b/addons/purchase/tests/test_onchange_product_id.py @@ -39,7 +39,7 @@ class TestOnchangeProductId(TransactionCase): tax_src_id=tax_include_id, tax_dest_id=tax_exclude_id)) # import pudb; pudb.set_trace() - res = self.so_line_model.onchange_product_id(cr, uid, [], pricelist, product_id, 1.0, uom_id, partner_id, + res = self.so_line_model.onchange_product_id(cr, uid, [], product_id, 1.0, uom_id, partner_id, fiscal_position_id=fp_id) self.assertEquals(100, res['value']['price_unit'], "The included tax must be subtracted to the price") diff --git a/addons/purchase/tests/test_purchase_to_invoice.py b/addons/purchase/tests/test_purchase_to_invoice.py index 3478df9c1d5..5e524bfa8f7 100644 --- a/addons/purchase/tests/test_purchase_to_invoice.py +++ b/addons/purchase/tests/test_purchase_to_invoice.py @@ -40,8 +40,7 @@ class TestPurchase(common.TransactionCase): # In order to test I create purchase order and confirmed it. order = self.env['purchase.order'].create({ 'partner_id': partner.id, - 'location_id': location_id, - 'pricelist_id': 1}) + 'location_id': location_id, }) self.env['purchase.order.line'].create({ 'order_id': order.id, 'product_id': product_id, |
