python
my_module/
__init__.py
sale.py
sale.xml
report/
sale_report.xml
python
from trytond.model import Model, fields
class Sale(Model):
__name__ = 'sale.sale'
number = fields.Char('Number')
total_amount = fields.Float('Total Amount')
def create_invoice(self):
# Invoice creation logic
pass
<tree string="Sales">
<field name="number" string="Number"/>
<field name="total_amount" string="Total Amount"/>
</tree>
python
from trytond.model import ModelView, fields
class Sale(ModelView):
__name__ = 'sale.sale'
def apply_discount(self):
self.total_amount -= 10
self.save()
Sale.register()
<report string="Sale Report" report="sale.sale" name="my_module.sale_report">
<template>
<!-- Report template -->
</template>
</report>
pip install trytond