Add first control code
Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -3,13 +3,18 @@ from __future__ import unicode_literals
|
||||
from .classes import ControlCode
|
||||
|
||||
|
||||
class ControlCodeTest(ControlCode):
|
||||
arguments = ('argument_1',)
|
||||
label = 'Test'
|
||||
name = 'test'
|
||||
class ControlCodeAttributeEdit(ControlCode):
|
||||
arguments = ('attribute', 'value')
|
||||
label = 'Change document attribute'
|
||||
name = 'document_attribute_edit'
|
||||
|
||||
def execute(self):
|
||||
pass
|
||||
def execute(self, context):
|
||||
document = context['document_page'].document
|
||||
print("!@#@", self.attribute, self.value)
|
||||
setattr(document, self.attribute, self.value)
|
||||
print("!!", document.label)
|
||||
|
||||
document.save()
|
||||
|
||||
|
||||
ControlCode.register(control_code=ControlCodeTest)
|
||||
ControlCode.register(control_code=ControlCodeAttributeEdit)
|
||||
|
||||
Reference in New Issue
Block a user