Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
589 Vistas

   I want to filter invoice with tax prouduct and group by tax_ids




class Accountmove(models.Model):    _inherit = 'account.move'
    taxs = fields.Boolean(string="Is Tax view",                          help="Tax view")        @api.onchange('tax_ids')

    def _onchange_tax_ids(self):

        if not self.tax_ids:

            self.taxs = False

        else: 

           self.taxs = True
 




    record id="view_Invoices_search_form_inherit" model="ir.ui.view"> 

      field name="name">account.move.search.form.inherit       

field name="model">account.move       

field name="inherit_id" ref="account.view_account_journal_search"/>     

field name="arch" type="xml">           

xpath expr="//search" position="inside">               

filter string="Taxs" name="tax_ids" context="{'group_by':'taxs'}"/>                     

Avatar
Descartar
Autor Mejor respuesta

the filter and group by appear but appear all invoice  i want the taxs boolean change automatic when taxs_ids in any product the taxs is True



taxs = fields.Boolean(string="Is Tax view", help="Tax view", store=True)

    @api.onchange('tax_ids', 'product_id') 

   def _onchange_tax_ids(self): 

       if not self.tax_ids:  

          self.taxs = False 

       else:            

self.taxs = True

Avatar
Descartar
Mejor respuesta

Hi,

Please use the following corrected code within the inherit view file:

<xpath expr="//search" position="inside"> <separator/>

               <filter string="Taxs" name="tax_ids" domain="[('taxs', '=', True)]"/>
                <group expand='0'>
                    <filter name="groupby_taxs" context="{'group_by': 'taxs'}"/>
                </group>
            </xpath>


Hope it helps

Avatar
Descartar