Преглед изворни кода

Módulo para la carga de orden de servicio, tipo obra.

SEBAS пре 1 година
родитељ
комит
840bc80e39
3 измењених фајлова са 40 додато и 13 уклоњено
  1. 15 6
      models/orden_servicio.py
  2. BIN
      models/orden_servicio.pyc
  3. 25 7
      views/orden_servicio.xml

+ 15 - 6
models/orden_servicio.py

@@ -180,7 +180,11 @@ class ProductoServicio(models.Model):
 
     product_id = fields.Many2one('product.product', 'Producto')
     categ_id = fields.Many2one('product.category', 'Categoría de producto')
-    quantity = fields.Float('Cantidad')
+    quantity = fields.Float(
+        string='Cantidad',
+        default=1,
+        digits=(5, 3)
+    )
     price_unit = fields.Float('Precio de costo')
     subtotal = fields.Float('Subtotal', compute='compute_subtotal', store=True)
 
@@ -209,14 +213,16 @@ class ServicioInsumo(models.Model):
     )
     quantity = fields.Float(
         string='Cantidad',
-        default=1
+        default=1,
+        digits=(5, 3)
     )
     price_unit = fields.Float(
         string='Precio Unit.'
     )
     subtotal = fields.Float(
         string='Subtotal',
-        compute='compute_subtotal'
+        compute='compute_subtotal',
+        digits=(10, 0)
     )
 
 
@@ -284,14 +290,16 @@ class DevolucionInsumo(models.Model):
     )
     quantity = fields.Float(
         string='Cantidad',
-        default=1
+        default=1,
+        digits=(5, 3)
     )
     price_unit = fields.Float(
         string='Precio Unit.'
     )
     subtotal = fields.Float(
         string='Subtotal',
-        compute='compute_subtotal'
+        compute='compute_subtotal',
+        digits=(10, 0)
     )
 
 
@@ -327,7 +335,8 @@ class RecepcionFabrica(models.Model):
     )
     subtotal = fields.Float(
         string='Subtotal',
-        compute='compute_subtotal'
+        compute='compute_subtotal',
+        digits=(10, 0)
     )
 
     @api.one

BIN
models/orden_servicio.pyc


+ 25 - 7
views/orden_servicio.xml

@@ -41,8 +41,26 @@
                     <field name="sale_order_id"/>
                     <filter string="Mis tareas" domain="[('user_id','=',uid)]"/>
                     <filter string="Realizada" domain="[('state','=','done')]"/>
+                    <filter string="En progreso" domain="[('state','=','in_progress')]"/>
+                    <filter string="Pendiente" domain="[('state','=','draft')]"/>
+                    <filter string="Cancelado" domain="[('state','=','canceled')]"/>
                     <separator/>
-                    <group expand="0" string="Group By...">
+                  <filter string="Creado Hoy" domain="[('order_date', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('order_date', '&lt;=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
+                  <filter string="Creado mes actual" domain="[('order_date','&lt;',(context_today()+relativedelta(months=1)).strftime('%%Y-%%m-01')), ('order_date','&gt;=',time.strftime('%%Y-%%m-01'))]"/>
+                  <filter string="Creado semana anterior" domain="[('order_date', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('order_date', '&lt;=', ((context_today()+relativedelta(weeks=-1, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                  <filter string="Creado esta semana" domain="[('order_date', '&gt;=', ((context_today()+relativedelta(weeks=-1, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('order_date', '&lt;=', ((context_today()+relativedelta(weeks=0, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                  <filter string="Orden a realizar mes actual" domain="[('planned_start_date','&lt;',(context_today()+relativedelta(months=1)).strftime('%%Y-%%m-01')), ('planned_start_date','&gt;=',time.strftime('%%Y-%%m-01'))]"/>
+                  <filter string="Orden a realizar mes pasado" domain="[('planned_start_date','&gt;=',(context_today()-relativedelta(months=1)).strftime('%%Y-%%m-01')),('planned_start_date','&lt;',time.strftime('%%Y-%%m-01'))]"/>
+                  <filter string="Orden a realizar semana anterior" domain="[('planned_start_date', '&gt;=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('planned_start_date', '&lt;=', ((context_today()+relativedelta(weeks=-1, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                  <filter string="Orden a realizar esta semana" domain="[('planned_start_date', '&gt;=', ((context_today()+relativedelta(weeks=-1, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('planned_start_date', '&lt;=', ((context_today()+relativedelta(weeks=0, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                  <filter string="Orden a realizar hoy" domain="[('planned_start_date', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('planned_start_date', '&lt;=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
+                  <filter string="Orden a realizar ayer" domain="[('planned_start_date','&lt;=', (datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d')),('planned_start_date','&gt;=',(datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d'))]"/>
+
+                    <group expand="0" string="Agrupar por...">
+                        <filter string="Por dia" context="{'group_by':'date_invoice:day'}"/>
+                        <filter string="Por mes" context="{'group_by':'date_invoice:month'}"/>
+                        <filter string="Por dia a realizar" context="{'group_by':'planned_start_date:day'}"/>
+                        <filter string="Por mes a realizar" context="{'group_by':'planned_start_date:month'}"/>
                         <filter string="Usuario" domain="[]" context="{'group_by':'user_id'}" />
                         <filter string="Cliente" domain="[]" context="{'group_by':'partner_id'}" />
                         <filter string="Estado" name="State" context="{'group_by':'state'}"/>
@@ -217,7 +235,7 @@
                           <field name="categ_id"/>
                           <field name="quantity"/>
                           <field name="price_unit"/>
-                          <field name="subtotal"/>
+                          <field name="subtotal" sum="total"/>
                       </tree>
                   </field>
               </record>
@@ -247,7 +265,7 @@
                                        <field name="categ_id"/>
                                        <field name="quantity"/>
                                        <field name="price_unit"/>
-                                       <field name="subtotal"/>
+                                       <field name="subtotal" sum="total"/>
                                    </group>
                                </sheet>
                            </form>
@@ -275,7 +293,7 @@
                   <field name="descripcion"/>
                   <field name="quantity"/>
                   <field name="price_unit"/>
-                  <field name="subtotal"/>
+                  <field name="subtotal" sum="total"/>
               </tree>
           </field>
       </record>
@@ -305,7 +323,7 @@
                                <field name="descripcion"/>
                                <field name="quantity"/>
                                <field name="price_unit"/>
-                               <field name="subtotal"/>
+                               <field name="subtotal" sum="total"/>
                            </group>
                        </sheet>
                    </form>
@@ -386,7 +404,7 @@
                       <field name="descripcion"/>
                       <field name="quantity"/>
                       <field name="price_unit"/>
-                      <field name="subtotal"/>
+                      <field name="subtotal" sum="total"/>
                     </tree>
                 </field>
               </record>
@@ -416,7 +434,7 @@
                                    <field name="descripcion"/>
                                    <field name="quantity"/>
                                    <field name="price_unit"/>
-                                   <field name="subtotal"/>
+                                   <field name="subtotal" sum="total"/>
                                  </group>
                              </sheet>
                          </form>