PowerSchool Python API Plugin - python-3.x

I am attempting to connect to the PowerSchool SIS API via the Python PowerSchool library.
From the installation instructions here, I am stuck on the part where I need to create an XML file (including Oauth) for uploading as a plugin (via System > System Settings > Plugin Management Dashboard > {Your Plugin}). I am looking for an example showing how to do this in detail. I have tried looking at the information available in PowerSource here but this documentation does not show exactly what to do.
Thanks in advance for any help you can provide.

I think you must log in to the Powerschool system to install the plugin before you can connect to the API.
The plugin should look something like this...
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://plugin.powerschool.pearson.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation='http://plugin.powerschool.pearson.com plugin.xsd'
name="(Your Product Name)"
version="(Your Product Version)"
description="The plugin for PowerSchool integration with (Your Product Name)">
<oauth></oauth>
<publisher name="(Your Company Name)">
<contact email="(Your Email Address)" />
</publisher>
<access_request>
<field table="CodeSet" field="description" access="ViewOnly" />
<field table="CodeSet" field="codetype" access="ViewOnly" />
<field table="CodeSet" field="codesetid" access="ViewOnly" />
<field table="CodeSet" field="code" access="ViewOnly" />
<field table="STUDENTS" field="DCID" access="ViewOnly" />
<field table="STUDENTS" field="ID" access="ViewOnly" />
<field table="STUDENTS" field="first_name" access="ViewOnly" />
<field table="STUDENTS" field="last_name" access="ViewOnly" />
<field table="STUDENTS" field="grade_level" access="ViewOnly" />
<field table="TRANSPORTATION" field="DCID" access="FullAccess" />
<field table="TRANSPORTATION" field="ID" access="FullAccess" />
<field table="TRANSPORTATION" field="StudentId" access="FullAccess" />
<field table="TRANSPORTATION" field="Description" access="FullAccess" />
</access_request>
</plugin>
There are various places where you need to put your own information, like company name, product name, etc...
Then, you will need to put the tables and columns you want/need access to in the access_request node. Note, you must specify the type of access you require, such as ViewOnly or FullAccess.
This is a security measure. The Powerschool administrator for the school you are dealing with can then decide whether to allow the plugin or not. Once the plugin is installed, the Powerschool administrator should tell you the ClientId and the client secret to use for OAuth authentication.

Related

Odoo 12 - Model not found even though it exists

I am porting a localization accountability model from Odoo 8 to Odoo 12, I ported a function that worked flawlessly but then right after that I tried porting some other code that does not interfere with the first on, even though, whenever it is initialized by the init.py Odoo brings up an error telling me that the model cannot be found, even though it is correctly set up.
All I've tried is to ignore the new modules I added right after setting up the one that should be perfectly working right now. Without them (or without any new module at all, because I've tried porting different ones) it works, but this shouldn't be the case at all.
wizard_nro_ctrl.py
class WizNroctrl(models.TransientModel):
_name = 'nroctrl'
_description = "Wizard that changes the invoice control number"
new_nroctrl = fields.Char('Control Number', required=True)
sure = fields.Boolean('Are you sure?')
# Change control number of the invoice
def set_noctrl(self):
if not self.sure:
raise except_orm('Error!', 'Please confirm that you want to do this by checking the option')
current_id = self._context['current_id']
inv_object = self.env['account.invoice'].browse(current_id)
inv_object.nro_ctrl = self.new_nroctrl
return True
wizard_nro_ctrl_view.xml
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<data>
<record model="ir.ui.view" id="wizard_nro_ctrl_form">
<field name="name">wizard.nro.ctrl.form</field>
<field name="model">nroctrl</field>
<field name="arch" type="xml">
<form string="Changing the Control Number">
<field name="new_nroctrl" placeholder="New control number"/>
<separator string="Are you sure you want to do this?" colspan="4"/>
<field name="sure"/>
<footer>
<button name="set_noctrl" string="Confirm" type="object"/>
<button special="cancel" string="Cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_wiz_nroctrl" model="ir.actions.act_window">
<field name="name">Change control number</field>
<field name="type">ir.actions.act_window</field>
<field name="model">wiz.nroctrl</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</odoo>
The init.py has the model initialized and the folder as well.
The model should work just fine, without this error. There's no reason to my knowledge for this issue.
odoo.tools.convert.ParseError: "Error while validating constraint
Model not found: nroctrl
Please make sure that in the model action you have wrote include model name 'nroctrl'. give the below xml code (nroctrl):
<record id="action_wiz_nroctrl" model="ir.actions.act_window">
<field name="name">Change control number</field>
<field name="type">ir.actions.act_window</field>
<field name="model">nroctrl</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
Also please ensure that you have given file name in init.py of wizard folder. also the folder name in ini.py of module.

How to restrict access to partners by create_uid

I need to limit user access only to partners added himself.
That's what I have made:
security.xml of my module:
<odoo>
<data noupdate="1">
<record model="ir.rule" id="partner_access_user_rule">
<field name="name">Parners only for editors</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="domain_force"> [('create_uid','=',user.id)] </field>
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
</record>
</data>
</odoo>
Update I have changed ref="base.model_res_partner" as Lucas told, and my module have installed, but the rule didn't uppear in settings > security>"record rules" and didn't apply. I've added record rule via web interface and it works. How I to export it to apply to my module? The record rule settings I've added to question.
Export file:
id,"perm_create","perm_unlink","perm_read","perm_write","domain_force","groups/id","name","model_id/id"
__export__.ir_rule_97,"True","True","True","True","[('create_uid','=',user.id)]","base.group_user","Partners only for editors","account.model_res_partner"
Your code is looking for the model res.partner on mail.partner.access, when it should look on base.
Try the following:
<field name="model_id" ref="base.model_res_partner"/>
If your row-level access rule doesn't work, create and test it using Odoo interface, export it to csv and change your original XML. Or create xml directly from CSV (look at attached picture). In my case I've found mistake: model_id should refer to base.model_res_partner

ODOO How to run automated actions at a specific time everyday

I am trying to add a cron job that should run every day at 12 pm. I am facing a few issue and have a few doubts.
I was able to run it every minute but couldn't run it at a specific time.
How to know which timezone is expected and which timezone is set in the "nextcall" field
It doesnt run until I open console in the browser. How can it be done so that it runs at the server and no additional action is needed?
<record id="ir_cron_module_get_active_sr" model="ir.cron">
<field name="name">Get Active Srs</field>
<field name="user_id" ref="base.user_root" />
//<field name="interval_number">2</field>
//<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="nextcall" eval="(datetime.utcnow() + timedelta(days=0)).strftime('%Y-%m-%d 12:22:00')" />
<field name="doall" eval="True" />
<field name="model" eval="'sd.cron'" />
<field name="function" eval="'get_active_srs'" />
<field name="args" eval="'(None,)'" />
<field name="priority">1</field>
</record>
Maybe you are omitting this line:
<field name="active">True</field>
Functionally you can check it under Settings --> Automation --> Scheduled Actions with the debut mode activated.
What I can see on your code is that this 2 lines aren't well commented (you wanted to comment them or it was a copy pasta mistake?)
//<field name="interval_number">2</field>
//<field name="interval_type">minutes</field>
Check if that's the right time you want to run the next test, it is in UCT time, you can check the UTC time in linux with timedatectl on a terminal (in ubuntu at least)
<field name="nextcall" eval="(datetime.utcnow() + timedelta(days=0)).strftime('%Y-%m-%d 12:22:00')" />
I don't know in what context are you using this cron, but remember that the model must be the one that contains the function that you are calling. So, be sure that sd.cron has the method get_active_srs
<field name="model" eval="'sd.cron'" />
At the end, if you are not passing any arguments you can omit this line
<field name="args" eval="'(None,)'" />

Sharepoint hosted app localize to list columns

I created a SharePoint hosted app and a new list. But I want to show its list column display name by a resources file. For that I created a new resource
from rigth click Feature > Add Feature Resource then the created key is PersonName and the value Person Name.
After I wrote in the list schema.xml
<Field ID="{27912FBB-5063-4FF7-9829-B194DDBC7FEB}" Type="Text" Name="PersonName" DisplayName="$Resources:PersonName" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="PersonName" MaxLength="255" />
But the list columns seems to be
$Resources:_FeatureId{54A6CD41-6DB3-45FF-9A2F-D496A13A871F},PersonName;
How can I fix that?
I am sure pretty late, but I just had the same problem and I figured it out.
What you are probably doing is try to use the resource key inside of the schema.xml of the list.
That is the wrong place to use it. Instead copy the whole line:
<Field ID="{27912FBB-5063-4FF7-9829-B194DDBC7FEB}" Type="Text" Name="PersonName" DisplayName="$Resources:PersonName" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="PersonName" MaxLength="255" />
Inside of the elements.xml of the list where the list definition is. So it should for your example look like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate
Name="UserList"
Type="100"
BaseType="0"
OnQuickLaunch="TRUE"
SecurityBits="11"
Sequence="410"
DisplayName="UserList"
Description="My List Definition"
Image="/_layouts/15/images/itgen.png"/>
<Field ID="{27912FBB-5063-4FF7-9829-B194DDBC7FEB}" Type="Text"
Name="PersonName" DisplayName="$Resources:PersonName"
Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="PersonName" MaxLength="255" />
</Elements>
If you read carefully this is also documented in the msdn:
https://msdn.microsoft.com/en-us/library/office/fp179919.aspx#LocalizingAppWeb
search for the title "To localize the column names of a custom list" and you should find it.

"Field type <name> is not installed properly"

SharePoint's telling me the following field type is 'not installed properly'
<?xml version="1.0" encoding="utf-8" ?>
<FieldTypes>
<FieldType>
<Field Name="TypeName">InfoClass</Field>
<Field Name="ParentType">Choice</Field>
<Field Name="TypeDisplayName">xyzInfoClass</Field>
<Field Name="TypeShortDescription">xyzDescription</Field>
<Field Name="UserCreatable">FALSE</Field>
<Field Name="Sortable">TRUE</Field>
<Field Name="AllowBaseTypeRendering">FALSE</Field>
<Field Name="Filterable">TRUE</Field>
<Field Name="FieldTypeClass">SharePointProject1.CustomFieldType.InfoClass, SharePointProject1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=16fde6e7376d101b</Field>
<PropertySchema>
<Fields>
</Fields>
</PropertySchema>
<RenderPattern Name="DisplayPattern">
<Column HTMLEncode="TRUE" />
</RenderPattern>
</FieldType>
</FieldTypes>
I cut it down to what I pasted here and I still get the error. The namespace and assembly are correct and the dll is deployed to the GAC. Event receivers in the same project work, so I dont think it's the code. Having removed everything else I dont know what the problem could be
I'd ask in a proper sharepoint forum but I have IE7. so. this is the only site on the internet that works. and that includes the entire microsoft domain

Resources