diff options
| author | Stephan Christianus <stephanchrst@gmail.com> | 2023-01-27 02:29:27 +0000 |
|---|---|---|
| committer | Stephan Christianus <stephanchrst@gmail.com> | 2023-01-27 02:29:27 +0000 |
| commit | 0377b1d5150171a9907b0f5bb06f970d4cf0959d (patch) | |
| tree | 52dde3389ad2e8e6cd262d8a96bb05b11c114319 /indoteknik_api/models | |
| parent | d9431f5ff267f05af08955ce16543b31535527dd (diff) | |
| parent | cbc41d6fc6126ba630dcfedda55694af3e5b23bc (diff) | |
Merged in staging (pull request #28)
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 | ||||
| -rw-r--r-- | indoteknik_api/models/blog_post.py | 3 |
3 files changed, 23 insertions, 1 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 diff --git a/indoteknik_api/models/blog_post.py b/indoteknik_api/models/blog_post.py index 2a82c23c..079181e2 100644 --- a/indoteknik_api/models/blog_post.py +++ b/indoteknik_api/models/blog_post.py @@ -9,7 +9,8 @@ class BlogPost(models.Model): base_url = self.env['ir.config_parameter'].get_param('web.base.url') data = { 'id': blog.id, - 'thumbnail': base_url + 'api/image/blog.post/thumbnail/' + str(blog.id) if blog.thumbnail else '', + # 'thumbnail': base_url + 'api/image/blog.post/thumbnail/' + str(blog.id) if blog.thumbnail else '', + 'thumbnail': self.env['ir.attachment'].api_image('blog.post', 'thumbnail', blog.id), 'title': blog.name, 'category': {}, 'author': {}, |
