Browse Source

Módulo para para validar de forma rápida ventas a factura

SEBAS 2 tháng trước cách đây
mục cha
commit
3f370c70fc
5 tập tin đã thay đổi với 18 bổ sung23 xóa
  1. BIN
      __init__.pyc
  2. BIN
      models/__init__.pyc
  3. 10 0
      models/sale_fast_confirm.py
  4. BIN
      models/sale_fast_confirm.pyc
  5. 8 23
      views/sale_view.xml

BIN
__init__.pyc


BIN
models/__init__.pyc


+ 10 - 0
models/sale_fast_confirm.py

@@ -62,3 +62,13 @@ class SaleOrder(models.Model):
         for order in self:
             order.write({'state': 'done'})
         return True
+
+    @api.multi
+    def action_cancel(self):
+        """
+        Cancel the sale order if it's in 'draft' or 'sent' state.
+        """
+        for order in self:
+            if order.state in ['draft', 'sent']:
+                order.write({'state': 'cancel'})
+        return True

BIN
models/sale_fast_confirm.pyc


+ 8 - 23
views/sale_view.xml

@@ -7,28 +7,12 @@
             <field name="inherit_id" ref="sale.view_order_form"/>
             <field name="arch" type="xml">
 
-                <!-- Confirmacion Rapida -->
+                <!-- Confirmación rápida -->
                 <button name="action_button_confirm" states="sent" position="after">
                     <button name="order_process_now" string="Procesar Venta" type="object" states="draft,sent" groups="base.group_user"/>
                 </button>
 
-                <!-- Enviar por Mail -->
-                <button name="action_quotation_send" position="replace">
-                    <button name="action_quotation_send" string="Send by Email" type="object" states="draft" class="oe_highlight" groups="base.group_user" invisible="1"/>
-                </button>
-                <button name="action_quotation_send" states="sent,progress,manual" position="replace">
-                    <button name="action_quotation_send" string="Send by Email" type="object" groups="base.group_user" invisible="1"/>
-                </button>
-
-                <!-- Imprimir Pedido -->
-                <button name="print_quotation" states="draft" position="replace">
-                    <button name="print_quotation" string="Print" type="object" states="draft" class="oe_highlight" groups="base.group_user" invisible="1"/>
-                </button>
-                <button name="print_quotation" states="sent,progress,manual" position="replace">
-                     <button name="print_quotation" string="Print" type="object" states="sent,progress,manual" groups="base.group_user" invisible="1"/>
-                </button>
-
-                <!-- confirmar pedido -->
+                <!-- Confirmar pedido -->
                 <button name="action_button_confirm" position="replace">
                    <button name="action_button_confirm" states="draft" string="Confirm Sale" type="object" groups="base.group_user" invisible="1"/>
                 </button>
@@ -36,18 +20,19 @@
                     <button name="action_button_confirm" states="sent" string="Confirm Sale" class="oe_highlight" type="object" groups="base.group_user" invisible="1"/>
                 </button>
 
-                <!-- cancelar pedido -->
-                <button name="invoice_cancel" position="replace">
-                    <button name="invoice_cancel" states="invoice_except" string="Cancel Order" groups="base.group_user" invisible="1"/>
-                </button>
+                <!-- Cancelar cotización (Hacer visible en estado 'draft') -->
                 <button name="cancel" position="replace">
-                    <button name="cancel" states="sent" string="Cancel Quotation" groups="base.group_user" invisible="1"/>
+                    <button name="cancel" states="draft, sent" string="Cancel Quotation" type="object" groups="base.group_user" invisible="0"/> <!-- Cambiar invisible="1" a invisible="0" -->
                 </button>
+
+                <!-- Cancelar pedido -->
                 <button name="action_cancel" position="replace">
                     <button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" groups="base.group_user" invisible="1"/>
                 </button>
+
             </field>
         </record>
+
         <record id="order_process_now_action" model="ir.actions.server">
             <field name="name">Fast Confirm</field>
             <field name="model_id" ref="model_sale_order"/>