[IMP] purchase: changes related to the cleaning of the PO workflow

bzr revid: qdp-launchpad@openerp.com-20120525143549-w8ste0euwmqg9ji9
This commit is contained in:
Quentin (OpenERP) 2012-05-25 16:35:49 +02:00
parent c4d31012d1
commit ab07d440ce
7 changed files with 27 additions and 145 deletions

View File

@ -33,9 +33,12 @@
</div>
</div>
<t t-if="(doc.state == 'draft' or doc.state == 'sent')">
<t t-if="(doc.state == 'draft' or doc.state == 'sent') and doc.__model == 'sale.order'">
<h1 class="oe_edi_doc_title">Quotation <t t-esc="doc.name"/>: <t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></h1>
</t>
<t t-if="(doc.state == 'draft' or doc.state == 'sent') and doc.__model == 'purchase.order'">
<h1 class="oe_edi_doc_title">Request for Quotation <t t-esc="doc.name"/>: <t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></h1>
</t>
<t t-if="(doc.state != 'draft' and doc.state != 'sent')">
<h1 class="oe_edi_doc_title">Order <t t-esc="doc.name"/>: <t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></h1>
</t>

View File

@ -57,6 +57,7 @@ PURCHASE_ORDER_EDI_STRUCT = {
'amount_total': True,
'amount_untaxed': True,
'amount_tax': True,
'state':True,
}
class purchase_order(osv.osv, EDIMixin):

View File

@ -48,7 +48,7 @@
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
<p>Here is a purchase order confirmation from ${object.company_id.name}: </p>
<p>Here is a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order confirmation'} from ${object.company_id.name}: </p>
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
&nbsp;&nbsp;<strong>REFERENCES</strong><br />
@ -65,7 +65,7 @@
</p>
<p>
You can view the order confirmation document and download it using the following link:
You can view the ${object.state in ('draft', 'sent') and 'request for quotation' or 'order confirmation'} document and download it using the following link:
</p>
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
href="${ctx.get('edi_web_url_view') or ''}">View Order</a>
@ -111,7 +111,7 @@
<field name="body_text"><![CDATA[
Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},
Here is a purchase order confirmation from ${object.company_id.name}:
Here is a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order confirmation'} from ${object.company_id.name}:
| Order number: *${object.name}*
| Order total: *${object.amount_total} ${object.pricelist_id.currency_id.name}*
| Order date: ${object.date_order}
@ -123,126 +123,7 @@ Here is a purchase order confirmation from ${object.company_id.name}:
% endif
| Your contact: ${object.validator.name} ${object.validator.user_email and '<%s>'%(object.validator.user_email) or ''}
You can view the order confirmation and download it using the following link:
${ctx.get('edi_web_url_view') or 'n/a'}
If you have any question, do not hesitate to contact us.
Thank you!
--
${object.validator.name} ${object.validator.user_email and '<%s>'%(object.validator.user_email) or ''}
${object.company_id.name}
% if object.company_id.street:
${object.company_id.street or ''}
% endif
% if object.company_id.street2:
${object.company_id.street2}
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip or ''} ${object.company_id.city or ''}
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
% endif
% if object.company_id.phone:
Phone: ${object.company_id.phone}
% endif
% if object.company_id.website:
${object.company_id.website or ''}
% endif
]]></field>
</record>
<record id="email_template_edi_purchase_quatation" model="email.template">
<field name="name">Automated Quataion Request Notification Mail</field>
<field name="email_from">${object.validator.user_email or ''}</field>
<field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
<field name="email_to">${object.partner_id.email}</field>
<field name="model_id" ref="purchase.model_purchase_order"/>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); ">
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
<p>Here is a request for quotation from ${object.company_id.name}: </p>
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
&nbsp;&nbsp;<strong>REFERENCES</strong><br />
&nbsp;&nbsp;Order number: <strong>${object.name}</strong><br />
&nbsp;&nbsp;Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br />
&nbsp;&nbsp;Order date: ${object.date_order}<br />
% if object.origin:
&nbsp;&nbsp;Order reference: ${object.origin}<br />
% endif
% if object.partner_ref:
&nbsp;&nbsp;Your reference: ${object.partner_ref}<br />
% endif
&nbsp;&nbsp;Your contact: <a href="mailto:${object.validator.user_email or ''}?subject=Order%20${object.name}">${object.validator.name}</a>
</p>
<p>
You can view the request for quotation and download it using the following link:
</p>
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
href="${ctx.get('edi_web_url_view') or ''}">View Order</a>
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<p>Thank you!</p>
<br/>
<br/>
<div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
</div>
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
<span style="color: #222; margin-bottom: 5px; display: block; ">
% if object.company_id.street:
${object.company_id.street}<br/>
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
</span>
% if object.company_id.phone:
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
Phone:&nbsp; ${object.company_id.phone}
</div>
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<p></p>
</div>
</div>
]]></field>
<field name="body_text"><![CDATA[
Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},
Here is a request for quotation from ${object.company_id.name}:
| Order number: *${object.name}*
| Order total: *${object.amount_total} ${object.pricelist_id.currency_id.name}*
| Order date: ${object.date_order}
% if object.origin:
| Order reference: ${object.origin}
% endif
% if object.partner_ref:
| Your reference: ${object.partner_ref}<br />
% endif
| Your contact: ${object.validator.name} ${object.validator.user_email and '<%s>'%(object.validator.user_email) or ''}
You can view the quotation and download it using the following link:
You can view the ${object.state in ('draft', 'sent') and 'request for quotation' or 'order confirmation'} and download it using the following link:
${ctx.get('edi_web_url_view') or 'n/a'}
If you have any question, do not hesitate to contact us.

View File

@ -144,7 +144,7 @@ class purchase_order(osv.osv):
STATE_SELECTION = [
('draft', 'Draft PO'),
('wait', 'Waiting'),
('send', 'RFQ Sent'),
('sent', 'RFQ Sent'),
('confirmed', 'Waiting Approval'),
('approved', 'Purchase Order'),
('except_picking', 'Shipping Exception'),
@ -334,10 +334,7 @@ class purchase_order(osv.osv):
def wkf_send_rfq(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
if context.get('send_rfq', False):
template = mod_obj.get_object_reference(cr, uid, 'purchase', 'email_template_edi_purchase_quatation')
else:
template = mod_obj.get_object_reference(cr, uid, 'purchase', 'email_template_edi_purchase')
template = mod_obj.get_object_reference(cr, uid, 'purchase', 'email_template_edi_purchase')
template_id = template and template[1] or False
res = mod_obj.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')
res_id = res and res[1] or False

View File

@ -132,18 +132,18 @@
<field name="arch" type="xml">
<form layout="manual">
<div class="oe_form_topbar">
<button name="purchase_confirm" states="draft,send" string="Confirm Order"/>
<button name="purchase_confirm" states="draft,sent" string="Confirm Order" class="oe_form_button_hi"/>
<button name="wkf_send_rfq" states="draft" string="Send RFQ" type="object" context="{'send_rfq':True}"/>
<button name="wkf_send_rfq" states="confirmed" string="Resend Purchase Order" type="object"/>
<button name="action_cancel" states="except_picking,except_invoice,wait" string="Cancel" type="object" />
<button name="picking_ok" states="except_picking" string="Manually Corrected"/>
<button name="invoice_ok" states="except_invoice" string="Manually Corrected"/>
<button name="purchase_appbuyer" states="wait_auth" string="Approve Purchase"/>
<button name="purchase_approve" states="confirmed" string="Approve Order"/>
<button name="purchase_appbuyer" states="wait_auth" string="Approve Purchase" class="oe_form_button_hi"/>
<button name="purchase_approve" states="confirmed" string="Approve Order" class="oe_form_button_hi"/>
<button name="view_invoice" string="Receive Invoice" type="object" attrs="{'invisible': ['|', ('invoice_method','=','picking'), '|', ('state','!=', 'approved'), ('invoiced','=',True) ]}"/>
<button name="view_picking" string="Receive Products" type="object" attrs="{'invisible': ['|', ('shipped','=',True), ('state','!=', 'approved')]}"/>
<button name="action_cancel_draft" states="cancel,send,confirmed" string="Set to Draft" type="object"/>
<button name="purchase_cancel" states="draft,confirmed,wait_auth,send" string="Cancel"/>
<button name="action_cancel_draft" states="cancel,sent,confirmed" string="Set to Draft" type="object"/>
<button name="purchase_cancel" states="draft,confirmed,wait_auth,sent" string="Cancel"/>
<div class="oe_right">
<field name="state" nolabel="1" widget="statusbar" statusbar_visible="draft,approved,done" statusbar_colors='{"except_picking":"red","except_invoice":"red","confirmed":"blue","wait":"blue"}' readonly="1"/>
</div>

View File

@ -13,11 +13,11 @@
<field name="flow_start">True</field>
<field name="name">draft</field>
</record>
<record id="act_send" model="workflow.activity">
<record id="act_sent" model="workflow.activity">
<field name="wkf_id" ref="purchase_order"/>
<field name="name">send</field>
<field name="name">sent</field>
<field name="kind">function</field>
<field name="action">write({'state':'send'})</field>
<field name="action">write({'state':'sent'})</field>
</record>
<record id="act_confirmed" model="workflow.activity">
<field name="wkf_id" ref="purchase_order"/>
@ -96,18 +96,18 @@
<field name="act_to" ref="act_confirmed"/>
<field name="signal">purchase_confirm</field>
</record>
<record id="trans_draft_send" model="workflow.transition">
<record id="trans_draft_sent" model="workflow.transition">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_send"/>
<field name="act_to" ref="act_sent"/>
<field name="signal">send_rfq</field>
</record>
<record id="trans_send_confirmed" model="workflow.transition">
<field name="act_from" ref="act_send"/>
<record id="trans_sent_confirmed" model="workflow.transition">
<field name="act_from" ref="act_sent"/>
<field name="act_to" ref="act_confirmed"/>
<field name="signal">purchase_confirm</field>
</record>
<record id="trans_send_cancel" model="workflow.transition">
<field name="act_from" ref="act_send"/>
<record id="trans_sent_cancel" model="workflow.transition">
<field name="act_from" ref="act_sent"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">purchase_cancel</field>
</record>

View File

@ -47,7 +47,7 @@
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
<p>Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'}: </p>
<p>Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from {$object.company_id.name}: </p>
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
&nbsp;&nbsp;<strong>REFERENCES</strong><br />
@ -129,7 +129,7 @@
<field name="body_text"><![CDATA[
Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},
Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'}:
Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from ${object.company_id.name}:
| Order number: *${object.name}*
| Order total: *${object.amount_total} ${object.pricelist_id.currency_id.name}*
| Order date: ${object.date_order}