diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-01-26 17:00:30 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-01-26 17:00:30 +0700 |
| commit | 9cb38fa42adaf5943db84682ab66ec7f81ee86d8 (patch) | |
| tree | 854166c57232e1c74b8a33a245c024a388fe5ea1 /indoteknik_api/models | |
| parent | 36f67ca3cd1140a6e8d4cf537a1ce58d5b5ecdc7 (diff) | |
| parent | e48e4626b94f7e09b3bab95937cf4b7a5ca07e40 (diff) | |
Merge branch 'feature/rest-api' into staging
Diffstat (limited to 'indoteknik_api/models')
| -rw-r--r-- | indoteknik_api/models/__init__.py | 1 | ||||
| -rw-r--r-- | indoteknik_api/models/account_move.py | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/indoteknik_api/models/__init__.py b/indoteknik_api/models/__init__.py index d484500a..9af9f36e 100644 --- a/indoteknik_api/models/__init__.py +++ b/indoteknik_api/models/__init__.py @@ -1,3 +1,4 @@ +from . import account_move from . import blog_post from . import product_pricelist from . import product_product diff --git a/indoteknik_api/models/account_move.py b/indoteknik_api/models/account_move.py new file mode 100644 index 00000000..9fd6fb18 --- /dev/null +++ b/indoteknik_api/models/account_move.py @@ -0,0 +1,20 @@ +import datetime +from odoo import models +from pytz import timezone + + +class AccountMove(models.Model): + _inherit = 'account.move' + + def api_v1_single_response(self, account_move): + data = { + 'id': account_move.id, + 'name': account_move.name, + 'purchase_order_name': account_move.ref or '', + 'payment_term': account_move.invoice_payment_term_id.name or '', + 'sales': account_move.invoice_user_id.name, + 'amount_total': account_move.amount_total, + 'amount_residual': account_move.amount_residual, + 'invoice_date': account_move.invoice_date.strftime('%d/%m/%Y') or '' + } + return data |
