Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. # [HBTO] Determinar facturas pagadas sin CABA - (6331)
  2. # Server Action
  3.  
  4. inv_obj = env['account.invoice']
  5. am_obj = env['account.move']
  6. customer_inv_ids = inv_obj.search([('type','=','out_invoice'),('state','=','paid'),('id','=',5118)])
  7. supplier_inv_ids = inv_obj.search([('type','=','in_invoice'),('state','=','paid')])
  8.  
  9. res = {}
  10. caba_res = {}
  11. # raise Warning (len(customer_inv_ids))
  12. for inv in customer_inv_ids:
  13. if not inv.move_id:
  14. res[inv.id] = False
  15. line = inv.move_id.line_ids.filtered(lambda x: x.account_id == inv.account_id)
  16. matched_ids = line.mapped('matched_debit_ids') | line.mapped('matched_credit_ids')
  17. if not matched_ids:
  18. res[inv.id] = False
  19. raise Warning (inv)
  20. # if am_obj.search([('tax_cash_basis_rec_id','in',matched_ids.ids)]):
  21. # raise Warning ((inv, am_obj.search([('tax_cash_basis_rec_id','in',matched_ids.ids)])))
  22. # continue
  23. caba_res[inv.id] = am_obj.search([('tax_cash_basis_rec_id','in',matched_ids.ids)])
  24.  
  25. raise Warning(repr(caba_res))
  26.  
  27.  
  28. # Available variables:
  29. # - env: Odoo Environment on which the action is triggered
  30. # - model: Odoo Model of the record on which the action is triggered; is a void recordset
  31. # - record: record on which the action is triggered; may be void
  32. # - records: recordset of all records on which the action is triggered in multi-mode; may be void
  33. # - time, datetime, dateutil, timezone: useful Python libraries
  34. # - log: log(message, level='info'): logging function to record debug information in ir.logging table
  35. # - Warning: Warning Exception to use with raise
  36. # To return an action, assign: action = {...}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement