return children
-class report_lunchorder(osv.AbstractModel):
+class report_mrpbomstructure(osv.AbstractModel):
_name = 'report.mrp.report_mrpbomstructure'
_inherit = 'report.abstract_report'
- _template = 'mpr.report_mrpbomstructure'
+ _template = 'mrp.report_mrpbomstructure'
_wrapped_report_class = bom_structure
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
'group_mrp_properties': fields.boolean("Allow several bill of materials per products using properties",
implied_group='product.group_mrp_properties',
help="""The selection of the right Bill of Material to use will depend on the properties specified on the sales order and the Bill of Material."""),
+ #FIXME: Should be removed as module product_manufacturer has been removed
'module_product_manufacturer': fields.boolean("Define manufacturers on products ",
help='This allows you to define the following for a product:\n'
'* Manufacturer\n'
<label for="id" string="Products"/>
<div>
<div>
- <field name="module_product_manufacturer" class="oe_inline"/>
- <label for="module_product_manufacturer"/>
- </div>
- <div>
<field name="group_mrp_properties" class="oe_inline"/>
<label for="group_mrp_properties" />
</div>
for supplier in partner_pool.browse(cr, uid, supplier_ids, context=context):
price = product_price
# Compute price from Purchase pricelist of supplier
+ #FIXME: property_product_pricelist_purchase is defined in purchase
pricelist_id = supplier.property_product_pricelist_purchase.id
if pricelist_id:
price = pricelist_pool.price_get(cr, uid, [pricelist_id], product_id, product_qty, context=context).setdefault(pricelist_id, 0)
if move.purchase_line_id:
purchase_order = move.purchase_line_id.order_id
return purchase_order.partner_id, purchase_order.create_uid.id, purchase_order.currency_id.id
+ else:
+ partner = move.partner_id or (move.picking_id and move.picking_id.partner_id) or False
+ if partner:
+ if partner.property_product_pricelist_purchase and move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal':
+ currency = partner.property_product_pricelist_purchase.currency_id.id
+ return partner, uid, currency
return super(stock_move, self)._get_master_data(cr, uid, move, company, context=context)
+
def _get_invoice_line_vals(self, cr, uid, move, partner, inv_type, context=None):
res = super(stock_move, self)._get_invoice_line_vals(cr, uid, move, partner, inv_type, context=context)
if move.purchase_line_id:
res['price_unit'] = purchase_line.price_unit
return res
+
+ def attribute_price(self, cr, uid, move, context=None):
+ """
+ Attribute price to move, important in inter-company moves or receipts with only one partner
+ """
+ if move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and not move.price_unit:
+ partner = move.partner_id or (move.picking_id and move.picking_id.partner_id)
+ 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.id
+ price = pricelist_obj.price_get(cr, uid, [pricelist],
+ move.product_id.id, move.product_uom_qty, partner, {
+ 'uom': move.product_uom.id,
+ 'date': move.date,
+ })[pricelist]
+ if price:
+ self.write(cr, uid, [move.id], {'price_unit': price}, context=context)
+ return True
+ super(stock_move, self).attribute_price(cr, uid, move, context=context)
+
+
+
class stock_picking(osv.osv):
_inherit = 'stock.picking'
def attribute_price(self, cr, uid, move, context=None):
"""
- Attribute price to move, important in multi-company
+ Attribute price to move, important in inter-company moves or receipts with only one partner
"""
- if move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and not move.price_unit:
- partner = move.partner_id or (move.picking_id and move.picking_id.partner_id)
- 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.id
- price = pricelist_obj.price_get(cr, uid, [pricelist],
- move.product_id.id, move.product_uom_qty, partner, {
- 'uom': move.product_uom.id,
- 'date': move.date,
- })[pricelist]
- if not price:
- price = move.product_id.standard_price
- self.write(cr, uid, [move.id], {'price_unit': price})
+ price = move.product_id.standard_price
+ self.write(cr, uid, [move.id], {'price_unit': price})
def action_confirm(self, cr, uid, ids, context=None):
def _get_master_data(self, cr, uid, move, company, context=None):
''' returns a tuple (browse_record(res.partner), ID(res.users), ID(res.currency)'''
currency = company.currency_id.id
- if move.partner_id:
- if move.partner_id.property_product_pricelist_purchase and move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal':
- currency = move.partner_id.property_product_pricelist_purchase.currency_id.id
- elif move.partner_id.property_product_pricelist and move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal':
- currency = move.partner_id.property_product_pricelist.currency_id.id
- return move.picking_id.partner_id, uid, currency
+ partner = move.partner_id or (move.picking_id and move.picking_id.partner_id) or False
+ if partner:
+ if partner.property_product_pricelist and move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal':
+ currency = partner.property_product_pricelist.currency_id.id
+ return partner, uid, currency
def _create_invoice_line_from_vals(self, cr, uid, move, invoice_line_vals, context=None):
return self.pool.get('account.invoice.line').create(cr, uid, invoice_line_vals, context=context)