[IMP]Changed string 'Option' to 'Suggested Products', Added 'Suggested Products' on Quote template which let us select products and fill it to 'Suggested Products' on sale order.

bzr revid: pza@tinyerp.com-20140115111158-d2gfyi19arn28s3o
This commit is contained in:
Pooja Zankhariya (OpenERP) 2014-01-15 16:11:58 +05:00
parent 6b90f0a6d5
commit c722fff1f8
2 changed files with 55 additions and 27 deletions

View File

@ -32,6 +32,7 @@ class sale_quote_template(osv.osv):
'website_description': fields.html('Description'),
'quote_line': fields.one2many('sale.quote.line', 'quote_id', 'Quote Template Lines'),
'note': fields.text('Terms and conditions'),
'options': fields.one2many('sale.option.line', 'option_id', 'Optional Products Lines'),
}
def open_template(self, cr, uid, quote_id, context=None):
@ -105,7 +106,7 @@ class sale_order(osv.osv):
def onchange_template_id(self, cr, uid, ids, template_id, context=None):
lines = []
quote_template = self.pool.get('sale.quote.template').browse(cr, uid, template_id, context)
quote_template = self.pool.get('sale.quote.template').browse(cr, uid, template_id, context=context)
for line in quote_template.quote_line:
lines.append((0, 0, {
'name': line.name,
@ -116,7 +117,17 @@ class sale_order(osv.osv):
'website_description': line.website_description,
'state': 'draft',
}))
data = {'order_line': lines, 'website_description': quote_template.website_description, 'note': quote_template.note}
options = []
for option in quote_template.options:
options.append((0, 0, {
'product_id': option.product_id.id,
'name': option.name,
'quantity': option.quantity,
'uom_id': option.uom_id.id,
'price_unit': option.price_unit,
'discount': option.discount,
}))
data = {'order_line': lines, 'website_description': quote_template.website_description, 'note': quote_template.note, 'options': options}
return {'value': data}
def recommended_products(self, cr, uid, ids, context=None):

View File

@ -11,7 +11,7 @@
attrs="{'invisible': [('template_id','=',False)]}"/>
</xpath>
<xpath expr="//page[@string='Order Lines']" position="after">
<page string="Option">
<page string="Suggested Products">
<label string="Optional Products &amp; Services" for="options"/>
<field name="options">
<tree string="Sales Quote Template Lines" editable="bottom">
@ -49,36 +49,53 @@
<field name="name"/>
</h1>
</div>
<field name="quote_line">
<form string="Sales Quote Template Lines" version="7.0">
<group>
<notebook>
<page string="Lines">
<field name="quote_line">
<form string="Sales Quote Template Lines" version="7.0">
<group>
<field name="product_id" on_change="on_change_product_id(product_id)"/>
<label for="product_uom_qty"/>
<div>
<field
name="product_uom_qty" class="oe_inline"/>
</div>
<field name="price_unit"/>
<group>
<field name="product_id" on_change="on_change_product_id(product_id)"/>
<label for="product_uom_qty"/>
<div>
<field
name="product_uom_qty" class="oe_inline"/>
</div>
<field name="price_unit"/>
</group>
</group>
</group>
<notebook colspan="4">
<page string="Description">
<field name="name" />
</page>
<page string="Website Description">
<field name="website_description" />
</page>
</notebook>
</form>
<tree string="Sales Quote Template Lines" editable="bottom">
<notebook colspan="4">
<page string="Description">
<field name="name" />
</page>
<page string="Website Description">
<field name="website_description" />
</page>
</notebook>
</form>
<tree string="Sales Quote Template Lines" editable="bottom">
<field name="product_id" on_change="on_change_product_id(product_id)"/>
<field name="name"/>
<field name="product_uom_qty"/>
<field name="price_unit"/>
<field name="website_description" invisible="1"/>
</tree>
</field>
</page>
<page string="Suggested Products">
<field name="options">
<tree string="Sales Quote Template Lines" editable="bottom">
<field name="product_id" on_change="on_change_product_id(product_id)"/>
<field name="name"/>
<field name="product_uom_qty"/>
<field name="quantity"/>
<field name="uom_id"/>
<field name="price_unit"/>
<field name="discount"/>
<field name="website_description" invisible="1"/>
</tree>
</field>
</tree>
</field>
</page>
</notebook>
<field name="website_description" invisible="1"/>
<field name="note" placeholder="Terms and conditions..." nolable="1"/>
</sheet>