Compare commits
No commits in common. "19.0" and "main" have entirely different histories.
22
.gitignore
vendored
22
.gitignore
vendored
@ -1,22 +0,0 @@
|
|||||||
# Python
|
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
|
||||||
*$py.class
|
|
||||||
|
|
||||||
# Odoo
|
|
||||||
*.log
|
|
||||||
.env
|
|
||||||
.venv/
|
|
||||||
venv/
|
|
||||||
*.pot
|
|
||||||
*.po~
|
|
||||||
|
|
||||||
# VSCode
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
# PyCharm
|
|
||||||
.idea/
|
|
||||||
|
|
||||||
# OS
|
|
||||||
.DS_Store
|
|
||||||
Thumbs.db
|
|
||||||
@ -15,6 +15,11 @@ This module extends the Odoo Sign module to allow users to upload images as a fi
|
|||||||
'data/sign_item_type_data.xml',
|
'data/sign_item_type_data.xml',
|
||||||
],
|
],
|
||||||
'assets': {
|
'assets': {
|
||||||
|
'web.assets_frontend': [
|
||||||
|
'sign_image_field/static/src/css/sign_image_field.css',
|
||||||
|
'sign_image_field/static/src/js/sign_image_upload.js',
|
||||||
|
'sign_image_field/static/src/xml/sign_items_image.xml',
|
||||||
|
],
|
||||||
'web.assets_backend': [
|
'web.assets_backend': [
|
||||||
'sign_image_field/static/src/css/sign_image_field.css',
|
'sign_image_field/static/src/css/sign_image_field.css',
|
||||||
'sign_image_field/static/src/js/sign_image_upload.js',
|
'sign_image_field/static/src/js/sign_image_upload.js',
|
||||||
|
|||||||
BIN
__pycache__/__init__.cpython-312.pyc
Normal file
BIN
__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
controllers/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
controllers/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
controllers/__pycache__/main.cpython-312.pyc
Normal file
BIN
controllers/__pycache__/main.cpython-312.pyc
Normal file
Binary file not shown.
@ -6,14 +6,14 @@ from PIL import Image
|
|||||||
|
|
||||||
from odoo import http
|
from odoo import http
|
||||||
from odoo.http import request
|
from odoo.http import request
|
||||||
from odoo.tools.image import image_process
|
from odoo.tools import image_process
|
||||||
from odoo.addons.sign.controllers.main import Sign
|
from odoo.addons.sign.controllers.main import Sign
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class SignController(Sign):
|
class SignController(Sign):
|
||||||
|
|
||||||
@http.route(['/sign/sign/<int:request_id>/<token>'], type='jsonrpc', auth='public')
|
@http.route(['/sign/sign/<int:request_id>/<token>'], type='json', auth='public')
|
||||||
def sign_document(self, request_id, token, signature=None, items=None, **kwargs):
|
def sign_document(self, request_id, token, signature=None, items=None, **kwargs):
|
||||||
if items:
|
if items:
|
||||||
# Filter items that look like images (base64)
|
# Filter items that look like images (base64)
|
||||||
|
|||||||
BIN
models/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
models/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
models/__pycache__/sign_item_type.cpython-312.pyc
Normal file
BIN
models/__pycache__/sign_item_type.cpython-312.pyc
Normal file
Binary file not shown.
@ -8,9 +8,3 @@ class SignItemType(models.Model):
|
|||||||
_inherit = "sign.item.type"
|
_inherit = "sign.item.type"
|
||||||
|
|
||||||
item_type = fields.Selection(selection_add=[('image', "Image")], ondelete={'image': 'cascade'})
|
item_type = fields.Selection(selection_add=[('image', "Image")], ondelete={'image': 'cascade'})
|
||||||
|
|
||||||
def _compute_dimensions(self):
|
|
||||||
super(SignItemType, self.filtered(lambda r: r.item_type != 'image'))._compute_dimensions()
|
|
||||||
for record in self.filtered(lambda r: r.item_type == 'image'):
|
|
||||||
record.default_width = 0.2
|
|
||||||
record.default_height = 0.05
|
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
from . import test_sign_item_type
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
from odoo.tests.common import TransactionCase
|
|
||||||
|
|
||||||
class TestSignItemType(TransactionCase):
|
|
||||||
|
|
||||||
def test_image_item_type_dimensions(self):
|
|
||||||
""" Test that creating a sign item type of type 'image' computes dimensions correctly without error """
|
|
||||||
image_type = self.env['sign.item.type'].create({
|
|
||||||
'name': 'Test Image Field',
|
|
||||||
'item_type': 'image',
|
|
||||||
'field_size': 'regular_text', # Should be ignored for non-text types but required
|
|
||||||
})
|
|
||||||
|
|
||||||
# Trigger computation if not already done
|
|
||||||
image_type._compute_dimensions()
|
|
||||||
|
|
||||||
self.assertEqual(image_type.default_width, 0.2, "Default width for image should be 0.2")
|
|
||||||
self.assertEqual(image_type.default_height, 0.05, "Default height for image should be 0.05")
|
|
||||||
|
|
||||||
def test_other_item_type_dimensions(self):
|
|
||||||
""" Ensure standard types still work as expected """
|
|
||||||
signature_type = self.env['sign.item.type'].create({
|
|
||||||
'name': 'Test Signature',
|
|
||||||
'item_type': 'signature',
|
|
||||||
'field_size': 'regular_text',
|
|
||||||
})
|
|
||||||
signature_type._compute_dimensions() # Should rely on super
|
|
||||||
|
|
||||||
# Values from standard Odoo: 'signature': [0.2, 0.05]
|
|
||||||
self.assertEqual(signature_type.default_width, 0.2)
|
|
||||||
self.assertEqual(signature_type.default_height, 0.05)
|
|
||||||
Loading…
Reference in New Issue
Block a user