[IMP] Make sure property_ids on sale order line are visible and able to work

This commit is contained in:
Josse Colpaert 2014-09-03 15:24:49 +02:00
parent 064b1a3a40
commit 8b204e6751
3 changed files with 23 additions and 4 deletions

View File

@ -90,3 +90,13 @@ class sale_order_line(osv.osv):
_columns = {
'property_ids': fields.many2many('mrp.property', 'sale_order_line_property_rel', 'order_id', 'property_id', 'Properties', readonly=True, states={'draft': [('readonly', False)]}),
}
class stock_move(osv.osv):
_inherit = 'stock.move'
def _prepare_procurement_from_move(self, cr, uid, move, context=None):
res = super(stock_move, self)._prepare_procurement_from_move(cr, uid, move, context=context)
if res and move.procurement_id and move.procurement_id.property_ids:
res['property_ids'] = [(6, 0, [x.id for x in move.procurement_id.property_ids])]
return res

View File

@ -16,5 +16,18 @@
</field>
</record>
<record id="view_order_form_inherit_mrp" model="ir.ui.view">
<field name="name">sale.order.form.sale.stock.mrp</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='address_allotment_id']" position="after">
<field name="property_ids" widget="many2many_tags"
groups="sale.group_mrp_properties"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -62,10 +62,6 @@
<field name="delay" class="oe_inline"/> days
</div>
</xpath>
<!--<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='address_allotment_id']" position="after">
<field name="property_ids" widget="many2many_tags"
groups="sale.group_mrp_properties"/>
</xpath>-->
<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='tax_id']" position="before">
<field name="product_packaging" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_tmpl_id','=',product_id)]" groups="product.group_stock_packaging" />
</xpath>