[MERGE]: Merged lp:~openerp-dev/openobject-addons/trunk-fgi_purchase-cha

bzr revid: ssu@tinyerp.com-20121126055333-adoyfmt0pqc940ds
This commit is contained in:
Saurang Suthar
2012-11-26 11:23:33 +05:30
9 changed files with 35 additions and 19 deletions
+3 -3
View File
@@ -7,14 +7,14 @@
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Accounting" groups="account.group_account_user">
<page string="Accounting" groups="account.group_account_invoice">
<group name="properties">
<group>
<field name="property_account_income" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}"/>
<field name="property_account_income" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" groups="account.group_account_user"/>
<field name="taxes_id" colspan="2" attrs="{'readonly':[('sale_ok','=',0)]}" widget="many2many_tags"/>
</group>
<group>
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" />
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags"/>
</group>
</group>
@@ -44,7 +44,7 @@
% if object.partner_ref:
&nbsp;&nbsp;Your reference: ${object.partner_ref}<br />
% endif
% if object.user_id:
% if object.validator:
&nbsp;&nbsp;Your contact: <a href="mailto:${object.validator.email or ''}?subject=Order%20${object.name}">${object.validator.name}</a>
% endif
</p>
+24
View File
@@ -190,6 +190,7 @@ class purchase_order(osv.osv):
'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,
readonly=True, states={'draft':[('readonly',False)], 'sent':[('readonly',False)]},
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."
@@ -412,6 +413,20 @@ class purchase_order(osv.osv):
'context': ctx,
}
def print_quotation(self, cr, uid, ids, context=None):
'''
This function prints the request for quotation and mark it as sent, so that we can see more easily the next step of the workflow
'''
assert len(ids) == 1, 'This option should only be used for a single id at a time'
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'purchase.order', ids[0], 'send_rfq', cr)
datas = {
'model': 'purchase.order',
'ids': ids,
'form': self.read(cr, uid, ids[0], context=context),
}
return {'type': 'ir.actions.report.xml', 'report_name': 'purchase.quotation', 'datas': datas, 'nodestroy': True}
#TODO: implement messages system
def wkf_confirm_order(self, cr, uid, ids, context=None):
todo = []
@@ -1167,4 +1182,13 @@ class product_template(osv.osv):
product_template()
class mail_compose_message(osv.osv):
_inherit = 'mail.compose.message'
def send_mail(self, cr, uid, ids, context=None):
context = context or {}
if context.get('default_model') == 'purchase.order' and context.get('default_res_id'):
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'purchase.order', context['default_res_id'], 'send_rfq', cr)
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+5 -2
View File
@@ -198,7 +198,10 @@
<field name="arch" type="xml">
<form string="Purchase Order" version="7.0">
<header>
<button name="wkf_send_rfq" states="draft" string="Send Request for Quotation" type="object" context="{'send_rfq':True}" class="oe_highlight"/>
<button name="wkf_send_rfq" states="draft" string="Send RFQ by Mail" type="object" context="{'send_rfq':True}" class="oe_highlight"/>
<button name="wkf_send_rfq" states="sent" string="Send RFQ by Mail" type="object" context="{'send_rfq':True}"/>
<button name="print_quotation" string="Print" type="object" states="draft" class="oe_highlight" groups="base.group_user"/>
<button name="print_quotation" string="Print" type="object" states="sent" groups="base.group_user"/>
<button name="purchase_confirm" states="draft" string="Confirm Order"/>
<button name="purchase_confirm" states="sent" string="Confirm Order" class="oe_highlight"/>
<button name="wkf_send_rfq" states="confirmed" string="Resend Purchase Order" type="object" class="oe_highlight"/>
@@ -654,7 +657,7 @@
<field name="inherit_id" ref="account.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='property_account_expense']" position="replace" >
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" groups="account.group_account_user"/>
</xpath>
<xpath expr="//field[@name='supplier_taxes_id']" position="replace" >
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags" attrs="{'readonly':[('purchase_ok','=',0)]}"/>
@@ -88,6 +88,7 @@
<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">
<tr></tr>
<tr>
<td>
<para style="terp_default_Bold_9">Expected Delivery address:</para>
-3
View File
@@ -43,9 +43,6 @@ class purchase_config_settings(osv.osv_memory):
'group_costing_method':fields.boolean("Compute product cost price based on average cost",
implied_group='product.group_costing_method',
help="""Allows you to compute product cost price based on average cost."""),
'group_purchase_delivery_address': fields.boolean("Allow a different address for incoming products and invoicing",
implied_group='purchase.group_delivery_invoice_address',
help="Allows you to specify different delivery and invoice addresses on a purchase order."),
'module_warning': fields.boolean("Alerts by products or supplier",
help="""Allow to configure notification on products and trigger them when a user wants to purchase a given product or a given supplier.
Example: Product: this product is deprecated, do not purchase more than 5.
-4
View File
@@ -54,10 +54,6 @@
<field name="group_uom" class="oe_inline"/>
<label for="group_uom"/>
</div>
<div>
<field name="group_purchase_delivery_address" class="oe_inline"/>
<label for="group_purchase_delivery_address"/>
</div>
<div>
<field name="group_costing_method" class="oe_inline"/>
<label for="group_costing_method"/>
@@ -15,11 +15,6 @@
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<record id="group_delivery_invoice_address" model="res.groups">
<field name="name">Addresses in Purchase Orders</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record id="group_analytic_accounting" model="res.groups">
<field name="name">Analytic Accounting for Purchases</field>
<field name="category_id" ref="base.module_category_hidden"/>
@@ -7,7 +7,7 @@
<field name="arch" type="xml">
<form string="Purchase Requisition" version="7.0">
<group>
<field name="partner_id"/>
<field name="partner_id" context="{'default_supplier': 1, 'default_customer': 0}"/>
</group>
<footer>
<button name="create_order" string="Create Quotation" type="object" class="oe_highlight"/>