[FIX] Purchase : stock moves assigned to purchase line
lp bug: https://launchpad.net/bugs/386513 fixed bzr revid: jvo@tinyerp.com-20090708140212-81j8c86mlk594xpx
This commit is contained in:
parent
75e4b85c0e
commit
bd45e70f4f
|
@ -438,7 +438,7 @@ class purchase_order_line(osv.osv):
|
||||||
'taxes_id': fields.many2many('account.tax', 'purchase_order_taxe', 'ord_id', 'tax_id', 'Taxes'),
|
'taxes_id': fields.many2many('account.tax', 'purchase_order_taxe', 'ord_id', 'tax_id', 'Taxes'),
|
||||||
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
|
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
|
||||||
'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True),
|
'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True),
|
||||||
'move_id': fields.many2one('stock.move', 'Reservation', ondelete='set null'),
|
'move_ids': fields.one2many('stock.move', 'purchase_line_id', 'Reservation', readonly=True, ondelete='set null'),
|
||||||
'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'),
|
'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'),
|
||||||
'price_unit': fields.float('Unit Price', required=True, digits=(16, int(config['price_accuracy']))),
|
'price_unit': fields.float('Unit Price', required=True, digits=(16, int(config['price_accuracy']))),
|
||||||
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'),
|
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'),
|
||||||
|
@ -455,7 +455,7 @@ class purchase_order_line(osv.osv):
|
||||||
def copy_data(self, cr, uid, id, default=None,context={}):
|
def copy_data(self, cr, uid, id, default=None,context={}):
|
||||||
if not default:
|
if not default:
|
||||||
default = {}
|
default = {}
|
||||||
default.update({'state':'draft', 'move_id':False})
|
default.update({'state':'draft', 'move_id':[]})
|
||||||
return super(purchase_order_line, self).copy_data(cr, uid, id, default, context)
|
return super(purchase_order_line, self).copy_data(cr, uid, id, default, context)
|
||||||
|
|
||||||
def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom,
|
def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom,
|
||||||
|
|
|
@ -185,6 +185,10 @@
|
||||||
<page string="Notes">
|
<page string="Notes">
|
||||||
<field colspan="4" name="notes" nolabel="1"/>
|
<field colspan="4" name="notes" nolabel="1"/>
|
||||||
</page>
|
</page>
|
||||||
|
<page string="History" groups="base.group_extended">
|
||||||
|
<separator colspan="4" string="Stock Moves"/>
|
||||||
|
<field colspan="4" name="move_ids" nolabel="1" widget="many2many"/>
|
||||||
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
|
|
@ -60,6 +60,7 @@ class report_sale_order_product(osv.osv):
|
||||||
from sale_order s
|
from sale_order s
|
||||||
right join sale_order_line l on (s.id=l.order_id)
|
right join sale_order_line l on (s.id=l.order_id)
|
||||||
left join product_uom u on (u.id=l.product_uom)
|
left join product_uom u on (u.id=l.product_uom)
|
||||||
|
where l.product_uom_qty != 0
|
||||||
group by l.product_id, to_char(s.date_order, 'YYYY-MM-01'),s.state
|
group by l.product_id, to_char(s.date_order, 'YYYY-MM-01'),s.state
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
|
@ -105,6 +106,7 @@ class report_sale_order_category(osv.osv):
|
||||||
left join product_product p on (p.id=l.product_id)
|
left join product_product p on (p.id=l.product_id)
|
||||||
left join product_template t on (t.id=p.product_tmpl_id)
|
left join product_template t on (t.id=p.product_tmpl_id)
|
||||||
left join product_uom u on (u.id=l.product_uom)
|
left join product_uom u on (u.id=l.product_uom)
|
||||||
|
where l.product_uom_qty != 0
|
||||||
group by t.categ_id, to_char(s.date_order, 'YYYY-MM-01'),s.state
|
group by t.categ_id, to_char(s.date_order, 'YYYY-MM-01'),s.state
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
|
|
Loading…
Reference in New Issue