Jelajahi Sumber

NEW Smarticon para Cobros/Pagos

Sebas 6 tahun lalu
melakukan
92232600a4
7 mengubah file dengan 159 tambahan dan 0 penghapusan
  1. 22 0
      __init__.py
  2. TEMPAT SAMPAH
      __init__.pyc
  3. 40 0
      __openerp__.py
  4. 31 0
      res_partner.py
  5. TEMPAT SAMPAH
      res_partner.pyc
  6. 66 0
      res_partner_view.xml
  7. TEMPAT SAMPAH
      static/description/icon.png

+ 22 - 0
__init__.py

@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#                                                                               #
+#    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

TEMPAT SAMPAH
__init__.pyc


+ 40 - 0
__openerp__.py

@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+#################################################################################
+#                                                                               #
+#                                                                               #
+#    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 Cobros/Pagos',
+    'version': '0.1',
+    'category': 'Voucher',
+    'description': """
+Smarticon para Cobros/Pagos
+========================================
+
+Smarticon para Cobros/Pagos
+
+    """,
+    'author': 'Eiru/Sebastian Penayo',
+    'website': '',
+	'depends': ['report','account','base'],
+    'data': [
+		'res_partner_view.xml',
+    ],
+    'installable': True,
+}

+ 31 - 0
res_partner.py

@@ -0,0 +1,31 @@
+
+# -*- coding: utf-8 -*-
+# ,('customer', operator, 'true')
+##############################################################################  , ('type', '=', 'receipt')
+# import web_pdb;
+from openerp.osv import fields,osv
+
+class res_partner(osv.osv):
+    _inherit = 'res.partner'
+
+
+    def _voucher_count_customer(self, cr, uid, ids, field_name, arg, context=None):
+        res = dict(map(lambda x: (x,0), ids))
+        try:
+            for partner in self.browse(cr, uid, ids, context):
+
+                operator = '='
+                voucher_ids = self.pool['account.voucher'].search(cr, uid, [('partner_id', operator, partner.id)], context=context)
+                res[partner.id] =  len(partner.voucher_ids)
+
+        except:
+            pass
+        return res
+
+
+    _columns = {
+        'voucher_ids': fields.one2many('account.voucher', 'partner_id',\
+            'Cobros/Pagos'),
+        'voucher_count_customer': fields.function(_voucher_count_customer, string='# de Cobros/Pagos', type='integer')
+    }
+    # web_pdb.set_trace()

TEMPAT SAMPAH
res_partner.pyc


+ 66 - 0
res_partner_view.xml

@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+
+        <record id="act_res_partner_2_voucher" model="ir.actions.act_window">
+            <field name="name">Cobros/Pagos</field>
+            <field name="res_model">account.voucher</field>
+            <field name="view_mode">tree,form</field>
+             <field name="context">{'search_default_partner_id': active_id}</field>
+            <field name="view_id" eval="False"/>
+            <field name="search_view_id" ref="account_voucher.view_voucher_filter_sale"/>
+        </record>
+
+        <record model="ir.actions.act_window.view" id="action_voucher_tree_view_customer">
+            <field name="sequence" eval="1"/>
+            <field name="view_mode">tree</field>
+            <field name="view_id" ref="account_voucher.view_voucher_tree"/>
+            <field name="act_window_id" ref="smarticon_voucher_customer.act_res_partner_2_voucher"/>
+        </record>
+
+        <record model="ir.actions.act_window.view" id="action_voucher_form_view_customer">
+            <field name="sequence" eval="2"/>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="account_voucher.view_voucher_form"/>
+            <field name="act_window_id" ref="smarticon_voucher_customer.act_res_partner_2_voucher"/>
+        </record>
+
+        <!-- Partner kanban view inherte -->
+        <record model="ir.ui.view" id="voucher_partner_kanban_view">
+            <field name="name">voucher.customer.kanban.inherit</field>
+            <field name="model">res.partner</field>
+            <field name="inherit_id" ref="base.res_partner_kanban_view"/>
+            <field name="priority" eval="10"/>
+            <field name="arch" type="xml">
+                <field name="mobile" position="after">
+                    <field name="voucher_count_customer"/>
+                </field>
+                <xpath expr="//div[@class='oe_kanban_partner_links']" position="inside">
+                    <a name="%(smarticon_voucher_customer.act_res_partner_2_voucher)d" type="action" t-if="record.voucher_count_customer.value>0">
+                        <t t-esc="record.voucher_count_customer.value"/> Cobros/Pagos
+                    </a>
+                </xpath>
+            </field>
+        </record>
+
+        <!--  Partners inherited form -->
+        <record id="view_partners_form_voucher_customer" model="ir.ui.view">
+            <field name="name">view.res.partner.voucher.buttons</field>
+            <field name="model">res.partner</field>
+            <field name="inherit_id" ref="base.view_partner_form"/>
+                <!-- <field name="domain">[('customer','=',True)]</field> -->
+            <field name="priority" eval="55"/>
+            <field name="arch" type="xml">
+                    <xpath expr="//div[@name='buttons']" position="inside">
+                        <button class="oe_inline oe_stat_button" type="action" name="%(smarticon_voucher_customer.act_res_partner_2_voucher)d"
+                          attrs="{'invisible': [('active', '=', False)]}"
+                          icon="fa-star"
+                          context="{'search_default_partner_id': active_id}">
+                          <field string="Cobros/Pagos" name="voucher_count_customer" widget="statinfo"/>
+                        </button>
+                    </xpath>
+            </field>
+        </record>
+
+    </data>
+</openerp>

TEMPAT SAMPAH
static/description/icon.png