Ver código fonte

commit smarticon_contract

sebas 8 anos atrás
commit
a3ee18d65b
7 arquivos alterados com 164 adições e 0 exclusões
  1. 27 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 45 0
      __openerp__.py
  4. 26 0
      res_partner.py
  5. BIN
      res_partner.pyc
  6. 66 0
      res_partner_view.xml
  7. BIN
      static/description/icon.png

+ 27 - 0
__init__.py

@@ -0,0 +1,27 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    product_brand for OpenERP                                                  #
+#    Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).                   #
+#    Authors, Mathieu Lemercier, mathieu@netandco.net,                          #
+#             Franck Bret, franck@netandco.net                                  #
+#    Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.com>   #
+#                                                                               #
+#    This program is free software: you can redistribute it and/or modify       #
+#    it under the terms of the GNU Affero General Public License as             #
+#    published by the Free Software Foundation, either version 3 of the         #
+#    License, or (at your option) any later version.                            #
+#                                                                               #
+#    This program is distributed in the hope that it will be useful,            #
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of             #
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              #
+#    GNU Affero General Public License for more details.                        #
+#                                                                               #
+#    You should have received a copy of the GNU Affero General Public License   #
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.      #
+#                                                                               #
+#################################################################################
+###################################################################################
+# Product Brand is an Openobject module wich enable Brand management for products #
+###################################################################################
+from . import res_partner

BIN
__init__.pyc


+ 45 - 0
__openerp__.py

@@ -0,0 +1,45 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#    product_features for OpenERP                                                  #
+#    Copyright (C) 2009 NetAndCo (<http://www.netandco.net>).                   #
+#    Authors, Mathieu Lemercier, mathieu@netandco.net,                          #
+#             Franck Bret, franck@netandco.net                                  #
+#    Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@akretion.com>   #
+#                                                                               #
+#    This program is free software: you can redistribute it and/or modify       #
+#    it under the terms of the GNU Affero General Public License as             #
+#    published by the Free Software Foundation, either version 3 of the         #
+#    License, or (at your option) any later version.                            #
+#                                                                               #
+#    This program is distributed in the hope that it will be useful,            #
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of             #
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              #
+#    GNU Affero General Public License for more details.                        #
+#                                                                               #
+#    You should have received a copy of the GNU Affero General Public License   #
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.      #
+#                                                                               #
+#################################################################################
+###################################################################################
+# Product features is an Openobject module wich enable features management for products #
+###################################################################################
+{
+    'name': 'Smarticon para Contratos',
+    'version': '0.1',
+    'category': 'Sale',
+    'description': """
+Smarticon para Contratos
+========================================
+
+Smarticon para Contratos
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': '',
+	'depends': ['report','account_analytic_analysis','base'],
+    'data': [
+		'res_partner_view.xml',
+    ],
+    'installable': True,
+}

+ 26 - 0
res_partner.py

@@ -0,0 +1,26 @@
+
+import math
+
+from openerp.osv import osv, fields
+
+class res_partner(osv.osv):
+    _inherit = 'res.partner'
+
+    def _contract_count(self, cr, uid, ids, field_name, arg, context=None):
+        res = dict(map(lambda x: (x,0), ids))
+        # The current user may not have access rights for sale orders
+        try:
+            for partner in self.browse(cr, uid, ids, context):
+                res[partner.id] = len(partner.contract_ids)
+        except:
+            pass
+        return res
+
+    """ Inherits partner and adds Tasks information in the partner form """
+    _columns = {
+        'contract_ids': fields.one2many('account.analytic.account', 'partner_id', 'Contract'),
+        'contract_count': fields.function(_contract_count, string='# Contrato', type='integer'),
+    }
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

BIN
res_partner.pyc


+ 66 - 0
res_partner_view.xml

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+
+		<record id="act_res_partner_2_contract" model="ir.actions.act_window">
+            <field name="name">Contratos</field>
+            <field name="res_model">account.analytic.account</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="context">{'search_default_partner_id': active_id}</field>
+            <field name="groups_id"/>
+            <field name="help" type="html">
+              <p class="oe_view_nocontent_create">
+                Click to create a quotation or sales order for this customer.
+              </p><p>
+                Odoo will help you efficiently handle the complete sale flow:
+                quotation, sales order, delivery, invoicing and
+                payment.
+              </p><p>
+                The social feature helps you organize discussions on each sales
+                order, and allow your customer to keep track of the evolution
+                of the sales order.
+              </p>
+            </field>
+        </record>
+
+		<!-- Partner kanban view inherte -->
+        <record model="ir.ui.view" id="contract_partner_kanban_view">
+            <field name="name">contract.kanban.saleorder.inherit</field>
+            <field name="model">res.partner</field>
+            <field name="inherit_id" ref="base.res_partner_kanban_view"/>
+            <field name="priority" eval="20"/>
+            <field name="arch" type="xml">
+                <field name="mobile" position="after">
+                    <field name="contract_count"/>
+                </field>
+                <xpath expr="//div[@class='oe_kanban_partner_links']" position="inside">
+                    <a name="%(smarticon_contract.act_res_partner_2_contract)d" type="action" t-if="record.contract_count.value>0">
+                        <t t-esc="record.contract_count.value"/> Contratos
+                    </a>
+                </xpath>
+            </field>
+        </record>
+
+		<!--  Partners inherited form -->
+        <record id="view_contract_partner_info_form" model="ir.ui.view">
+            <field name="name">res.partner.contract.buttons</field>
+            <field name="model">res.partner</field>
+            <field name="inherit_id" ref="base.view_partner_form"/>
+            <field name="priority" eval="50"/>
+            <field name="groups_id"/>
+            <field name="arch" type="xml">
+                <xpath expr="//div[@name='buttons']" position="inside">
+                    <button class="oe_inline oe_stat_button" type="action" name="%(smarticon_contract.act_res_partner_2_contract)d"
+						              attrs="{'invisible': [('customer', '=', False)]}"
+						              icon="fa-paste"
+						              context="{'search_default_partner_id': active_id}">
+                          <field string="Contratos" name="contract_count" widget="statinfo"/>
+                    </button>
+                </xpath>
+            </field>
+       </record>
+
+
+    </data>
+</openerp>

BIN
static/description/icon.png