Randhir Mayatra (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-addons20_purchase-rma into 
lp:openobject-addons.

Requested reviews:
  Amit Patel (OpenERP) (apa-tiny)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons20_purchase-rma/+merge/136098

Hello Sir,

 -- I have make changes into purchase as per the requiremnet on the pad.

Thank you...
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons20_purchase-rma/+merge/136098
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-addons20_purchase-rma.
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2012-11-20 11:36:00 +0000
+++ purchase/purchase.py	2012-11-26 06:30:26 +0000
@@ -175,8 +175,8 @@
             help="Put an address if you want to deliver directly from the supplier to the customer. " \
                 "Otherwise, keep empty to deliver to your own company."
         ),
-        'warehouse_id': fields.many2one('stock.warehouse', 'Destination Warehouse', states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}),
-        'location_id': fields.many2one('stock.location', 'Destination', required=True, domain=[('usage','<>','view')]),
+        'warehouse_id': fields.many2one('stock.warehouse', 'Destination Warehouse'),
+        'location_id': fields.many2one('stock.location', 'Destination', required=True, domain=[('usage','<>','view')], states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]} ),
         'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."),
         'currency_id': fields.related('pricelist_id', 'currency_id', type="many2one", relation="res.currency", readonly=True, required=True),
         'state': fields.selection(STATE_SELECTION, 'Status', readonly=True, help="The status of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' status. Then the order has to be confirmed by the user, the status switch to 'Confirmed'. Then the supplier must confirm the order to change the status to 'Approved'. When the purchase order is paid and received, the status becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the status becomes in exception.", select=True),
@@ -189,7 +189,7 @@
         'shipped_rate': fields.function(_shipped_rate, string='Received', type='float'),
         'invoiced': fields.function(_invoiced, string='Invoice Received', type='boolean', help="It indicates that an invoice has been paid"),
         'invoiced_rate': fields.function(_invoiced_rate, string='Invoiced', type='float'),
-        'invoice_method': fields.selection([('manual','Based on Purchase Order lines'),('order','Based on generated draft invoice'),('picking','Based on incoming shipments')], 'Invoicing Control', required=True,
+        'invoice_method': fields.selection([('manual','Based on Purchase Order lines'),('order','Based on generated draft invoice'),('picking','Based on incoming shipments')], 'Invoicing Control', required=True,states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]},
             help="Based on Purchase Order lines: place individual lines in 'Invoice Control > Based on P.O. lines' from where you can selectively create an invoice.\n" \
                 "Based on generated invoice: create a draft invoice you can validate later.\n" \
                 "Bases on incoming shipments: let you create an invoice when receptions are validated."
@@ -214,13 +214,13 @@
         'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
         'product_id': fields.related('order_line','product_id', type='many2one', relation='product.product', string='Product'),
         'create_uid':  fields.many2one('res.users', 'Responsible'),
-        'company_id': fields.many2one('res.company','Company',required=True,select=1),
+        'company_id': fields.many2one('res.company','Company',required=True,select=1, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}),
         'journal_id': fields.many2one('account.journal', 'Journal'),
     }
     _defaults = {
         'date_order': fields.date.context_today,
         'state': 'draft',
-        'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'purchase.order'),
+        'name': lambda obj, cr, uid, context: '/',
         'shipped': 0,
         'invoice_method': 'order',
         'invoiced': 0,
@@ -237,6 +237,9 @@
     _order = "name desc"
 
     def create(self, cr, uid, vals, context=None):
+        if ('name' not in vals) or (vals.get('name')=='/'):
+            seq_obj_name =  self._name
+            vals['name'] = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)
         order =  super(purchase_order, self).create(cr, uid, vals, context=context)
         if order:
             self.create_send_note(cr, uid, [order], context=context)
@@ -526,7 +529,28 @@
         if res:
             self.invoice_send_note(cr, uid, ids, res, context)
         return res
+    def action_view_invoice(self, cr, uid, ids, context=None):
+        '''
+        This function returns an action that display existing invoices of given purchase order ids. It can either be a in a list or in a form view, if there is only one invoice to show.
+        '''
+        mod_obj = self.pool.get('ir.model.data')
+        act_obj = self.pool.get('ir.actions.act_window')
 
+        result = mod_obj.get_object_reference(cr, uid, 'account', 'action_invoice_tree1')
+        id = result and result[1] or False
+        result = act_obj.read(cr, uid, [id], context=context)[0]
+        #compute the number of invoices to display
+        inv_ids = []
+        for po in self.browse(cr, uid, ids, context=context):
+            inv_ids += [invoice.id for invoice in po.invoice_ids]
+        #choose the view_mode accordingly
+        if len(inv_ids)>1:
+            result['domain'] = "[('id','in',["+','.join(map(str, inv_ids))+"])]"
+        else:
+            res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
+            result['views'] = [(res and res[1] or False, 'form')]
+            result['res_id'] = inv_ids and inv_ids[0] or False
+        return result
     def invoice_done(self, cr, uid, ids, context=None):
         self.write(cr, uid, ids, {'state':'approved'}, context=context)
         self.invoice_done_send_note(cr, uid, ids, context=context)

=== modified file 'purchase/purchase_view.xml'
--- purchase/purchase_view.xml	2012-11-21 16:27:53 +0000
+++ purchase/purchase_view.xml	2012-11-26 06:30:26 +0000
@@ -208,6 +208,8 @@
                     <button name="purchase_approve" states="confirmed" string="Approve Order" class="oe_highlight" groups="purchase.group_purchase_manager"/>
                     <button name="view_picking" string="Receive Products" type="object" attrs="{'invisible': ['|', ('shipped','=',True), ('state','!=', 'approved')]}" class="oe_highlight"/>
                     <button name="view_invoice" string="Receive Invoice" type="object" attrs="{'invisible': ['|', ('invoice_method','=','picking'), '|', ('state','!=', 'approved'), ('invoiced','=',True) ]}" class="oe_highlight"/>
+                    <button name="action_view_invoice" string="View Invoice" type="object" class="oe_highlight" attrs="{'invisible': [ ('state','!=', 'done')]}"
+                             groups="base.group_user"/>
                     <button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object" />
                     <button name="purchase_cancel" states="draft,confirmed,sent" string="Cancel"/>
                     <field name="state" widget="statusbar" statusbar_visible="draft,sent,approved,done" statusbar_colors='{"except_picking":"red","except_invoice":"red","confirmed":"blue"}' readonly="1"/>
@@ -262,8 +264,7 @@
                                 <field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
                             </group>
                             <div class="oe_clear"/>
-                            <label for="notes"/>
-                            <field name="notes" class="oe_inline"/>
+                            <field name="notes" class="oe_inline" placeholder="Terms and conditions..."/>
                         </page>
                         <page string="Incoming Shipments &amp; Invoices">
                             <group>

=== modified file 'purchase/purchase_workflow.xml'
--- purchase/purchase_workflow.xml	2012-09-17 08:06:10 +0000
+++ purchase/purchase_workflow.xml	2012-11-26 06:30:26 +0000
@@ -145,7 +145,7 @@
         <record id="trans_router_invoice_no_order" model="workflow.transition">
             <field name="act_from" ref="act_router"/>
             <field name="act_to" ref="act_invoice_end"/>
-            <field name="condition">invoice_method&lt;&gt;'order' and invoiced</field>
+            <field name="condition">invoice_method&lt;&gt;'order'</field>
         </record>
         <record id="trans_except_picking_picking_done" model="workflow.transition">
             <field name="act_from" ref="act_except_picking"/>

=== modified file 'purchase/report/request_quotation.rml'
--- purchase/report/request_quotation.rml	2012-09-28 05:04:33 +0000
+++ purchase/report/request_quotation.rml	2012-11-26 06:30:26 +0000
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
-<document filename="Request for Quotation.pdf">
-  <template title="Request for Quotation" author="OpenERP S.A.([email protected])" allowSplitting="20">
+<document filename="test.pdf">
+  <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
     <pageTemplate id="first">
-      <frame id="first" x1="18.0" y1="42.0" width="535" height="758"/>
+      <frame id="first" x1="23.0" y1="43.0" width="530" height="799"/>
     </pageTemplate>
   </template>
   <stylesheet>
@@ -10,7 +10,11 @@
       <blockAlignment value="LEFT"/>
       <blockValign value="TOP"/>
     </blockTableStyle>
-    <blockTableStyle id="Table_Address_Detail">
+    <blockTableStyle id="Tableau1">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau2">
       <blockAlignment value="LEFT"/>
       <blockValign value="TOP"/>
     </blockTableStyle>
@@ -33,6 +37,7 @@
     <initialize>
       <paraStyle name="all" alignment="justify"/>
     </initialize>
+    <paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
     <paraStyle name="Standard" fontName="Helvetica"/>
     <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
     <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
@@ -69,49 +74,45 @@
     <images/>
   </stylesheet>
   <story>
-  <pto>
-  <pto_header>
-    <blockTable colWidths="371.0,98.0,61.0" repeatRows="1" style="Table_Product_Header_Title">
-      <tr>
-        <td>
-          <para style="terp_tblheader_Details">Description</para>
-        </td>
-        <td>
-          <para style="terp_tblheader_Details_Centre">Expected Date</para>
-        </td>
-        <td>
-          <para style="terp_tblheader_Details_Centre">Qty</para>
-        </td>
-      </tr>
-    </blockTable>
-  </pto_header>
     <para style="terp_default_9">[[repeatIn(objects,'order')]]</para>
     <para style="terp_default_9">[[ setLang(order.partner_id.lang) ]]</para>
-    <blockTable colWidths="250.0,59.0,221.0" style="Table_Address_Detail">
+    <para style="terp_default_9">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="250.0,59.0,221.0" style="Tableau1">
       <tr>
         <td>
-          <para style="terp_default_Bold_9">Expected Delivery address:</para>
-          <para style="terp_default_9">[[ (order.dest_address_id and order.dest_address_id.name) or (order.warehouse_id and order.warehouse_id.name) or '']]</para>
-          <para style="terp_default_9">[[ order.dest_address_id and display_address(order.dest_address_id) ]] </para>
-        </td>
-        <td>
-          <para style="terp_default_9">
-            <font color="white"> </font>
-          </para>
-        </td>
-        <td>
-          <para style="terp_default_9">[[ (order.partner_id.title and order.partner_id.title.name) or '' ]] [[ order.partner_id.name ]]</para>
-          <para style="terp_default_9">[[ display_address(order.partner_id) ]] </para>
-          <para style="terp_default_9">
-            <font color="white"> </font>
-          </para>
-          <para style="terp_default_9">Tel.: [[ (order.partner_id.phone) or removeParentNode('para') ]]</para>
-          <para style="terp_default_9">Fax: [[ (order.partner_id.fax) or removeParentNode('para') ]]</para>
-          <para style="terp_default_9">TVA: [[ (order.partner_id.vat) or removeParentNode('para') ]]</para>
+          <blockTable colWidths="250.0" style="Tableau2">
+            <tr>
+              <td>
+                <para style="terp_default_Bold_9">Expected Delivery address:</para>
+                <para style="terp_default_9">[[ (order.dest_address_id and order.dest_address_id.name) or (order.warehouse_id and order.warehouse_id.name) or '']]</para>
+                <para style="P1">[[ order.dest_address_id and display_address(order.dest_address_id) ]]</para>
+              </td>
+            </tr>
+          </blockTable>
+          <para style="terp_default_9">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="terp_default_9">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="terp_default_9">[[ (order .partner_id and order.partner_id.title and order.partner_id.title.name) or '' ]] [[ (order .partner_id and order.partner_id.name) or '' ]] </para>
+          <para style="terp_default_9">[[ order.partner_id and display_address(order .partner_id) ]] </para>
+          <para style="terp_default_9">
+            <font color="white"> </font>
+          </para>
+          <para style="terp_default_9">Tel.: [[ (order.partner_id and order.partner_id.phone) or removeParentNode('para') ]]</para>
+          <para style="terp_default_9">Fax: [[ (order.partner_id and order.partner_id.fax) or removeParentNode('para') ]]</para>
+          <para style="P1">TVA: [[ (order.partner_id and order.partner_id.vat) or removeParentNode('para') ]]</para>
         </td>
       </tr>
     </blockTable>
-    <para style="terp_default_8">
+    <para style="Standard">
       <font color="white"> </font>
     </para>
     <para style="terp_header">Request for Quotation : [[order.name]]</para>
@@ -132,7 +133,7 @@
       </tr>
     </blockTable>
     <section>
-      <para style="terp_default_2">[[repeatIn(order.order_line,'order_line')]]</para>
+      <para style="terp_default_9">[[ repeatIn(order.order_line,'order_line') ]]</para>
       <blockTable colWidths="370.0,100.0,39.0,20.0" style="Table_Product_Line">
         <tr>
           <td>
@@ -148,6 +149,11 @@
             <para style="terp_default_Right_9">[[ (order_line.product_uom and order_line.product_uom.name) or '' ]]</para>
           </td>
         </tr>
+        <tr>
+          <td>
+            <para style="terp_default_8_italic">[[ format(order_line.notes or removeParentNode('tr')) ]]</para>
+          </td>
+        </tr>
       </blockTable>
     </section>
     <para style="terp_default_9">
@@ -165,6 +171,5 @@
       <font color="white"> </font>
     </para>
     <para style="terp_default_9">[[ user.signature or '' ]]</para>
-  </pto>
   </story>
-</document>
\ No newline at end of file
+</document>

=== modified file 'purchase/report/request_quotation.sxw'
Binary files purchase/report/request_quotation.sxw	2012-09-21 11:36:51 +0000 and purchase/report/request_quotation.sxw	2012-11-26 06:30:26 +0000 differ
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to