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

Agregar fecha promesa pago

sebas пре 4 година
родитељ
комит
a111c59c57
2 измењених фајлова са 20 додато и 1 уклоњено
  1. 1 1
      account_invoice.py
  2. 19 0
      account_invoice_view.xml

+ 1 - 1
account_invoice.py

@@ -27,7 +27,7 @@ class account_invoice(models.Model):
         comodel_name='hr.employee',
         string='Cobrador'
     )
-    promesa_date = fields.Datetime(
+    promesa_date = fields.Date(
         string='Fecha Promesa Pago'
     )
 

+ 19 - 0
account_invoice_view.xml

@@ -14,5 +14,24 @@
                 </field>
             </field>
         </record>
+
+        <record id="view_accountinvoices_filter_search1" model="ir.ui.view">
+            <field name="name">accountinvoices.filter.search1</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.view_account_invoice_filter" />
+            <field name="arch" type="xml">
+              <search>
+                  <filter string="Promesa esta semana" domain="[('promesa_date', '&gt;=', ((context_today()+relativedelta(weeks=-1, days=1, weekday=0)).strftime('%%Y-%%m-%%d'))),('promesa_date', '&lt;=', ((context_today()+relativedelta(weeks=0, weekday=6)).strftime('%%Y-%%m-%%d')))]"/>
+                  <filter string="Promesa hoy" domain="[('promesa_date', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('promesa_date', '&lt;=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
+                  <filter string="Promesa ayer" domain="[('promesa_date','&lt;=', (datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d')),('promesa_date','&gt;=',(datetime.date.today()-relativedelta(days=1)).strftime('%%Y-%%m-%%d'))]"/>
+                  <separator/>
+                  <group string="Agrupar por">
+                      <filter string="Por dia promesa" context="{'group_by':'promesa_date:day'}"/>
+                      <filter string="Por mes promesa" context="{'group_by':'promesa_date:month'}"/>
+                  </group>
+               </search>
+            </field>
+        </record>
+
     </data>
 </openerp>