Rodney Enciso Arias преди 7 години
ревизия
5042e98633
променени са 9 файла, в които са добавени 147 реда и са изтрити 0 реда
  1. 1 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 51 0
      __openerp__.py
  4. 1 0
      models/__init__.py
  5. BIN
      models/__init__.pyc
  6. 51 0
      models/purchase_fast_confirm.py
  7. BIN
      models/purchase_fast_confirm.pyc
  8. BIN
      models/sale_fast_confirm.pyc
  9. 43 0
      views/purchase_view.xml

+ 1 - 0
__init__.py

@@ -0,0 +1 @@
+import models

BIN
__init__.pyc


+ 51 - 0
__openerp__.py

@@ -0,0 +1,51 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Odoo, Open Source Management Solution
+#
+#    Author: Andrius Laukavičius. Copyright: JSC NOD Baltic
+#
+#    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/>.     
+#
+##############################################################################
+
+
+{
+    'name': 'Purchase Fast Confirm',
+    'version': '1.1',
+    'category': 'Purchase',
+    'summary': 'Auto confirm invoice, delivery orders',
+    'description': """
+	After confirming purchase order, automatically creates invoice, validates it.
+    If there are delivery orders, it also confirms it too.
+	""",
+    'author': 'OERP / Eiru - Rodney Enciso Arias',
+    'website': 'www.oerp.eu',
+    'depends': [   
+        'purchase',
+    ],
+    'data': [
+        'views/purchase_view.xml',      
+    ],
+    'demo': [
+    ],
+    'test': [
+
+    ],
+    'installable': True,
+    'application': False,
+    'auto_install': False,
+    'images': [],
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 1 - 0
models/__init__.py

@@ -0,0 +1 @@
+import purchase_fast_confirm

BIN
models/__init__.pyc


+ 51 - 0
models/purchase_fast_confirm.py

@@ -0,0 +1,51 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Odoo, Open Source Management Solution
+#
+#    Author: Andrius Laukavičius. Copyright: JSC NOD Baltic
+#
+#    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/>.
+#
+##############################################################################
+
+from openerp import models, api
+
+class PurchaseOrder(models.Model):
+    _inherit = 'purchase.order'
+
+
+
+    def action_purchase_confirm(self, cr, uid, ids, context=None):
+        if not context:
+            context = {}
+        assert len(ids) == 1, 'This option should only be used for a single id at a time.'
+        self.signal_workflow(cr, uid, ids, 'purchase_confirm')
+        return True
+
+    @api.multi
+    def purchase_process_now(self):
+        """
+        Confirms order and creates and validates invoice, confirms pickings.
+        """
+        for purchase in self:
+            # Process order
+            purchase.action_purchase_confirm()
+            # inv_id = purchase.action_invoice_create()
+            # if inv_id:
+            #     inv = self.env['account.invoice'].browse(inv_id)
+            #     inv.signal_workflow('invoice_open')
+            for picking in purchase.picking_ids:
+                picking.force_assign()
+                picking.action_done()

BIN
models/purchase_fast_confirm.pyc


BIN
models/sale_fast_confirm.pyc


+ 43 - 0
views/purchase_view.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="view_purchase_confirm_form" model="ir.ui.view">
+            <field name="name">purchase.order.form - Confirm</field>
+            <field name="model">purchase.order</field>
+            <field name="inherit_id" ref="purchase.purchase_order_form"/>
+            <field name="arch" type="xml">
+                <button name="bid_received" states="sent" position="after">
+                    <button name="purchase_process_now" string="Procesar Compra" type="object" states="draft,sent" groups="base.group_user" class="oe_highlight"/>
+                </button>
+                <button name="print_quotation" position="attributes">
+                    <attribute name="invisible">1</attribute>
+                </button>
+                <button name="wkf_send_rfq" position="attributes">
+                    <attribute name="invisible">1</attribute>
+                </button>
+                <button name="purchase_confirm" position="attributes">
+                    <attribute name="invisible">1</attribute>
+                </button>
+                <button name="wkf_send_rfq" states="approved" position="attributes">
+                    <attribute name="invisible">1</attribute>
+                </button>
+            </field>
+        </record>
+        <record id="purchase_process_now_action" model="ir.actions.server">
+            <field name="name">Purchase Fast Confirm</field>
+            <field name="model_id" ref="model_purchase_order"/>
+            <field name="state">code</field>
+            <field name="code">
+                if context.get('active_model') == 'purchase.order' and context.get('active_ids'):
+                    self.purchase_process_now(cr, uid, context['active_ids'], context=context)
+            </field>
+        </record>
+
+        <record id="ir_purchase_process_now" model="ir.values">
+            <field eval="'client_action_multi'" name="key2"/>
+            <field eval="'purchase.order'" name="model"/>
+            <field name="name">Purchase Fast Confirm</field>
+            <field eval="'ir.actions.server,%d'%purchase_process_now_action" name="value"/>
+        </record>        
+    </data>
+</openerp>