Make notes global? - global

I have a client who wants to use notes and have them global across all users. It would be easiest to just remove the user dependency to display to all users. The other option is to add message_follower_ids upon creation to add a "general" channel as a follower but I'm clueless as to what the values would be.
Any thoughts, ideas, advice is greatly appreciated.

You can achieve using two methods.
You can inactive record rule of note.
<record id="note.note_note_rule_global" model="ir.rule">
<field name="name">Only followers can access a sticky notes</field>
<field name="model_id" ref="note.model_note_note"/>
<field name="active" eval="False"/>
<field name="domain_force">['|', ('user_id', '=', user.id), ('message_partner_ids', '=', user.partner_id.id)]</field>
<field name="global" eval="True"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
If you inactive above record rule then odoo will visible notes to all users.
Add followers inside note.
If you hide some notes for some users then you must not inactive record rule and just add followers.
This may help you.

Related

Wrong values in Interim Accounts when returning stock

I am using anglo saxon accounting ​method in my accounting and I use average pricing as my costing method in inventory. But I am struggling with the vendor stock returning process because after validating the return, stock interim account values are not as I expected. I want to return the stock to the vendor to the price of what bought but it returned to the current price.
https://www.odoo.com/documentation/user/12.0/accounting/others/inventory/avg_price_valuation.html
As the above link says, Odoo can cater stock returns to their purchase price (see section: “Further thoughts on anglo saxon mode”). But I run the same test case on my server (Odoo 12) as well as the Odoo demo server, but it returns to the current price.
Is there any specific configuration for enabling this process or am I doing something wrong?
all you need to do is inherit view_company_form view and add anglo_saxon_accounting field
<record id="view_company_form_inherit" model="ir.ui.view">
<field name="name">res.company.form.inherit</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='rml_header1']" position="after">
<separator string=""/>
<group >
<field name="anglo_saxon_accounting" />
</group>
</xpath>
</field>
</record>

quickfix: How to know whether a fid is in a group or not?

Let's assume there is such part in quickfix's data dictionary
<message name="Name" msgtype="type">
<field name="field1" required="Y"/>
<field name="field2" required="Y"/>
<field name="field3" required="N"/>
<group name="group1" required="Y">
<field name="field4" required="Y"/>
</group>
<group name="group2" required="Y">
<field name="field5" required="Y"/>
<field name="field6" required="N"/>
</group>
</message>
While sending request, I need to construct message correctly - set field5 in group2, field4 in group1, and field1 outside of any group. Is there a way in quickfix library to know, for example, if field4 is in a group or not? And in which group?
If not, how is it possible to use quickfix library, if you are depending on data dictionary client will use? I should force clients to configure data dictionary as I configured it?
I should force clients to configure data dictionary as I configured it?
Yes. A server ("acceptor") and its clients ("initiators") should all be using the same DataDictionary.
If you are providing a server, you should provide documentation that defines exactly what messages/fields you support, and how use use those messages and fields. If you don't provide a QuickFIX data dictionary file, you should provide sufficient information so that client firms can create one.
Is there a way in quickfix library to know, for example, if field4 is in a group or not? And in which group?
I think you are asking this question because you don't really know what you're doing yet. :)
I think there might be DD methods for this, but I can't really remember because they're not something people usually need. I don't think this is the right approach for whatever your problem is.

Change the content of a record field from an XML file

In OpenERP XML fields are used to load module data.
The <record> tag is used for this.
When reinstalling the module, the records are rewritten with the current data in the XML file.
But is there a way to change just one of the record fields without rewriting all the others?
For instance, in addons/project_issue/project_issue_view.xml we have this action definition:
<record id="project_issue_categ_action" model="ir.actions.act_window">
<field name="name">Issue Categories</field>
<field name="res_model">crm.case.categ</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
<field name="domain">[('object_id.model', '=', 'project.issue')]</field>
<field name="context" eval="{'object_id': ref('model_project_issue')}"/>
</record>
Is it possible to change just the name field in an XML file of a custom module?
I already tried :
<record id="project_issue.project_issue_categ_action" model="ir.actions.act_window">
<field name="name">Issue Categorization</field>
</record>
and
<update id="project_issue.project_issue_categ_action" model="ir.actions.act_window">
<field name="name">Issue Categorization</field>
</update>
<record id="project_issue.project_issue_categ_action" model="ir.actions.act_window">
<field name="name">Issue Categorization</field>
</record>
Your given code will change the name but won't affect menu name. You can see your given action name in form and tree view.
To change menu name, you have to override menu only not action.
For example:
<record id="project_issue.menu_project_issue_category_act" model="ir.ui.menu">
<field name="name">Issue Categorization</field>
</record>
You can even refer Apply groups on already created menus

Add user defined fields in the FIX dictionary

I need to add/modify fields in the FIX4.4 dictionary. I haven't found any helpful documentation or tutorials on this.
I'm guessing I have to modify the FIX44.xml file, but I'm not sure how exactly to do that.
In the <message></message> tags I don't see any attributes that define the number or the type(format) of that field. I see just the name and required attributes.
I think I found attributes I', looking for in the <fields></fields> tags.
I'm not sure if I'm looking in the right place or if I'm doing the right thing, but according to this I should modify the dictionary if it is necessary.
Please help.
A link to a tutorial for beginners that can help me would also be greatly appreciated.
The FIX Data Dictionary in QuickFIX contains Messages and Fields (among other things).
To add Messages you must add the message between the <messages></messages> tags like this:
<message name="CoolMessage" msgcat="app" msgtype="xCM">
<field name="Currency" required="N"/>
<field name="Text" required="N"/>
<field name="Account" required="Y"/>
</message>
And then add the new msgtype to the MsgType field in the <fields></fields> section like this:
<field number='35' name='MsgType' type='STRING'>
...
<value enum='xCM' description='COOLMESSAGE'/>
</field>
If you want to add new fields, just add them between the <fields></fields> tags like this:
<fields>
<field number="1" name="Account" type="STRING"/>
<field number="2" name="AdvId" type="STRING"/>
<field number="3" name="AdvRefID" type="STRING"/>
...
<field number="9006" name="AwesomeField" type="STRING"/>
</fields>
This and more information can be found in this tutorial.

OpenERP modeling / views: related object inline

I have installed the built in OpenERP 6.1 module crm.
As a result, I now have res.lead active and visible at "Sales->Opportunities".
I'd like to edit this object / view to show the partner's billing address.
Since I want to do this on the Opporunities form, there is already a partner_id.
Copying another module, I defined my new module like this:
class crm_lead(osv.osv):
_name = _inherit = 'crm.lead'
_columns = {
'billing_address_id': fields.many2one('res.partner.address', 'Partner Billing Address', domain="[('partner_id','=',partner_id),('type','in',['invoice', 'default'])]"),
}
And I changed my update_xml to:
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">Opportunity form (inherit)</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<data>
<separator string="Details" position="replace" />
<field name="description" position="replace">
<group colspan="2" col="4">
<separator colspan="4" string="Billing" />
<field widget="one2many_list" mode="form,tree" name="billing_address_id" colspan="4" nolabel="1" />
</group>
<group colspan="2" col="4">
<separator colspan="4" string="Details" />
<field name="description" nolabel="1" colspan="4" />
</group>
</field>
</data>
</field>
</record>
The problem is that the related object shows all the related fields (as I'd guess would be expected). In particular, it shows the partner_id and company fields, which I'd like to hide since they should default to / inherit from this opportunity (or the linked partner).
How can I hide these fields? I can't simply add a bunch of 'related' fields, as there is potentially more than one billing address.
Thanks for the help!
Edit: To be clearer, an opportunity should only have a single chosen billing address, chosen from the partner's invoice / default addresses. It should be displayed inline to allow easy editing.
There are a couple of ways to specify the view for related fields like this. You can use the context like this:
<field
name="order_line"
colspan="4"
nolabel="1"
context="{'form_view_ref': 'module.view_id', 'tree_view_ref': 'model.view_id'}"/>
You can also specify the whole view for the child record as a subview within the parent view like this:
<!-- <=== order_line is a one2many field -->
<field name="order_line" colspan="4" nolabel="1">
<form>
<field name="qty"/>
...
</form>
<tree>
<field name="qty"/>
...
</tree>
</field>
OK, I was a bit confused because you put a one2many widget on a many2one field.
If you want to control how a one2many field is displayed, use the subview or context methods I mentioned in my other answer.
If you want to control how a many2one field is displayed, you might be able to use related fields that pull fields from the record you selected, but I doubt it. Read-only might work, but I don't think it makes sense to edit multiple related fields and be able to change the selected record. You might be able to hack together some function fields with a store function that lets you write back to the related record, but it seems like it would really confuse your users.
On any OE Relation field you can define the Intenal View like :
<field name="" mode="tree,form">
<!--Internal tree view for your Relation field model-->
<tree>
</tree>
<!--Internal Form view for your Relation field model-->
<form>
</form>
</field>
Example Under Addons 1 Click to Example 2 Click to See Example
Hope this will help you,.
Now if yo uwan to shoe specific detail on your m2o file then we have some optional way also where you have to over the def name_get of your relational model, namge get look like :
name_get(cr, user, ids, context=None)
Returns the preferred display value (text representation) for the records with
the given ids. By default this will be the value of the name column, unless the
model implements a custom behavior. Can sometimes be seen as the inverse function
of name_search(), but it is not guaranteed to be.
Rtype : list(tuple)
Return : list of pairs (id,text_repr) for all records with the given ids.
So here in this method you can decide what string you want to show your relational field.
Example
This will fix your problem partially i guess.