[IMP] website_quote: add default quote template
authoravo-odoo <avo@openerp.com>
Tue, 15 Jul 2014 09:55:48 +0000 (15:25 +0530)
committerRichard Mathot <rim@openerp.com>
Mon, 4 Aug 2014 14:23:14 +0000 (16:23 +0200)
(Closes #1380)

addons/website_quote/data/website_quotation_data.xml
addons/website_quote/models/order.py

index d0d07af..83b2f34 100644 (file)
             ]]></field>
         </record>
 
+        <record id="website_quote_template_default" model="sale.quote.template">
+            <field name="name">Default Template</field>
+            <field name="number_of_days">30</field>
+            <field name="website_description" type="xml">
+                <section data-snippet-id="title">
+                    <center><h1 class="page-header">Our offer</h1></center>
+                </section>
+                <section data-snippet-id="text-block">
+                    <div class="row">
+                        <div class="col-md-12">
+                            <p>
+                                <h3 class="text-muted">Our offer is based on 3 commitments, which drive our business and our partners:</h3>
+                            </p>
+                        </div>
+                    </div>
+                </section>
+                <section data-snippet-id="quality">
+                    <div class="row mt32">
+                        <div class="col-md-4">
+                            <div class="panel panel-info">
+                                <div class="panel-heading">
+                                   <center><h3 class="panel-title">Quality</h3></center>
+                                </div>
+                                <div class="panel-body">
+                                   <p>
+                                       Quality in many ways, our reputation was built on the first value.
+                                   </p>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="col-md-4">
+                            <div class="panel panel-info">
+                                <div class="panel-heading">
+                                   <center><h3 class="panel-title">Service</h3></center>
+                                </div>
+                                <div class="panel-body">
+                                   <p>
+                                       We are always reachable to help you, do not hesitate to contact us at any time.
+                                   </p>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="col-md-4">
+                            <div class="panel panel-info">
+                                <div class="panel-heading">
+                                   <center><h3 class="panel-title">Price</h3></center>
+                                </div>
+                                <div class="panel-body">
+                                   <p>
+                                     Our prices are the lowest in the region, if you find cheaper elsewhere, we will refund the difference 
+                                   </p>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </section>
+                <section data-snippet-id="text-block">
+                    <center><h2>Your products/services</h2></center>
+                    <p>
+                        <h3 class="text-muted">
+                            The description of products/services from your quotation will be displayed below
+                        </h3>
+                    </p>
+                    <p>
+                           <b> To write a quotation description, edit your product, go the sales tab and add a text in "Description for quotations"</b>
+                    </p>
+                </section>
+            </field>
+        </record>
     </data>
 </openerp>
index c7ae4bc..93d93a9 100644 (file)
@@ -118,8 +118,17 @@ class sale_order(osv.osv):
         'amount_undiscounted': fields.function(_get_total, string='Amount Before Discount', type="float",
             digits_compute=dp.get_precision('Account'))
     }
+
+    def _get_template_id(self, cr, uid, context=None):
+        try:
+            template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'website_quote', 'website_quote_template_default')[1]
+        except ValueError:
+            template_id = False
+        return template_id
+
     _defaults = {
-        'access_token': lambda self, cr, uid, ctx={}: str(uuid.uuid4())
+        'access_token': lambda self, cr, uid, ctx={}: str(uuid.uuid4()),
+        'template_id' : _get_template_id,
     }
 
     def open_quotation(self, cr, uid, quote_id, context=None):