Advertisement
Guest User

Untitled

a guest
Dec 6th, 2022
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. from trytond.pool import PPoolMeta
  2. from trytond.model import fields, Workflow
  3. from trytond.transaction import Transaction
  4.  
  5.  
  6. class Invoice(metaclass=PoolMeta):
  7.     __name__ = 'account.invoice'
  8.  
  9.     @classmethod
  10.     @ModelView.button
  11.     @Workflow.transition('posted')
  12.     def post(cls, invoices):
  13.         for invoice in invoices:
  14.             for line in invoice.lines:
  15.                 line.set_value()
  16.         cls.save(invoices)
  17.         super().post(invoices)
  18.  
  19.  
  20. class InvoiceLine(metaclass=PoolMeta):
  21.     __name__ = 'account.invoice.line'
  22.    
  23.     saved_value = field.Boolean("Saved Value", readonly=True)
  24.    
  25.     def set_value(self)
  26.         self.saved_value = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement