Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # [HBTO] Determinar facturas pagadas sin CABA - (6331)
- # Server Action
- inv_obj = env['account.invoice']
- am_obj = env['account.move']
- customer_inv_ids = inv_obj.search([('type','=','out_invoice'),('state','=','paid'),('id','=',5118)])
- supplier_inv_ids = inv_obj.search([('type','=','in_invoice'),('state','=','paid')])
- res = {}
- caba_res = {}
- # raise Warning (len(customer_inv_ids))
- for inv in customer_inv_ids:
- if not inv.move_id:
- res[inv.id] = False
- line = inv.move_id.line_ids.filtered(lambda x: x.account_id == inv.account_id)
- matched_ids = line.mapped('matched_debit_ids') | line.mapped('matched_credit_ids')
- if not matched_ids:
- res[inv.id] = False
- raise Warning (inv)
- # if am_obj.search([('tax_cash_basis_rec_id','in',matched_ids.ids)]):
- # raise Warning ((inv, am_obj.search([('tax_cash_basis_rec_id','in',matched_ids.ids)])))
- # continue
- caba_res[inv.id] = am_obj.search([('tax_cash_basis_rec_id','in',matched_ids.ids)])
- raise Warning(repr(caba_res))
- # Available variables:
- # - env: Odoo Environment on which the action is triggered
- # - model: Odoo Model of the record on which the action is triggered; is a void recordset
- # - record: record on which the action is triggered; may be void
- # - records: recordset of all records on which the action is triggered in multi-mode; may be void
- # - time, datetime, dateutil, timezone: useful Python libraries
- # - log: log(message, level='info'): logging function to record debug information in ir.logging table
- # - Warning: Warning Exception to use with raise
- # To return an action, assign: action = {...}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement