[IMP] purchase : Added tag in kanban for 'Purchases', Added Button 'RFQs and Purchases' on the form and Removed 'RFQs and Purchases' from sidebar of supplier.

bzr revid: mdi@tinyerp.com-20120725065825-b2ceoexvrrwcxetk
This commit is contained in:
Divyesh Makwana (Open ERP) 2012-07-25 12:28:25 +05:30
parent 98ae051899
commit 1910f0dece
3 changed files with 58 additions and 8 deletions

View File

@ -24,6 +24,13 @@ from osv import fields, osv
class res_partner(osv.osv):
_name = 'res.partner'
_inherit = 'res.partner'
def _purchase_order_count(self, cr, uid, ids, field_name, arg, context=None):
res = {}
for partner in self.browse(cr, uid, ids, context):
res[partner.id] = len(partner.purchase_order_ids)
return res
_columns = {
'property_product_pricelist_purchase': fields.property(
'product.pricelist',
@ -33,6 +40,8 @@ class res_partner(osv.osv):
string="Purchase Pricelist",
view_load=True,
help="This pricelist will be used, instead of the default one, for purchases from the current partner"),
'purchase_order_count': fields.function(_purchase_order_count, string='# of Purchase Order', type='integer'),
'purchase_order_ids': fields.one2many('purchase.order','partner_id','Purchase Order')
}
res_partner()

View File

@ -13,6 +13,55 @@
</field>
</field>
</record>
<record id="act_res_partner_2_purchase_order" model="ir.actions.act_window">
<field name="name">RFQs and Purchases</field>
<field name="res_model">purchase.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'search_default_partner_id': active_id}</field>
<field name="groups_id" eval="[(4, ref('purchase.group_purchase_user'))]"/>
<field name="help">
This supplier has no RFQ or Purchase Order. Click here to create a new RFQ.
&lt;p&gt;
The "Quotation" is the first step of the Purchases flow. Manage your purchases from quotation to invoice.
&lt;p&gt;
You will be able to buy products (manage receptions) as well as services (create projects).
</field>
</record>
<!-- Partner kanban view inherited -->
<record model="ir.ui.view" id="purchase_partner_kanban_view">
<field name="name">res.partner.kanban.purchaseorder.inherit</field>
<field name="model">res.partner</field>
<field name="type">kanban</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
<field name="arch" type="xml">
<field name="mobile" position="after">
<field name="purchase_order_count"/>
</field>
<xpath expr="//h4[@class='oe_partner_heading']" position="after">
<a name="%(purchase.act_res_partner_2_purchase_order)d" type="action" t-if="record.purchase_order_count.value>0" class="oe_tag">
<t t-esc="record.purchase_order_count.value"/> Purchases
</a>
</xpath>
</field>
</record>
<record id="res_partner_view_purchase_buttons" model="ir.ui.view">
<field name="name">res.partner.view.purchase.buttons</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<button name="%(purchase.act_res_partner_2_purchase_order)d" type="action"
string="RFQs and Purchases"
groups="purchase.group_purchase_user"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -510,14 +510,6 @@
</field>
</record>
<act_window
context="{'search_default_partner_id': [active_id], 'default_partner_id': active_id}"
id="act_res_partner_2_purchase_order"
name="RFQs and Purchases"
groups="purchase.group_purchase_user"
res_model="purchase.order"
src_model="res.partner"/>
<act_window
context="{'search_default_product_id': [active_id], 'default_product_id': active_id}"
id="action_purchase_line_product_tree"