Overriding a field of base Content Type in Sensenet 6.4 - sensenet

My custom 'IPAProject' CTD is based on Workspace CTD.
If I override inherited Description field in the following way (lines omitted for brevity):
<ContentType name="IPAProject" parentType="Workspace" handler="SenseNet.ContentRepository.Workspaces.Workspace" xmlns="http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition">
.
.
.
<Field name='Description' type='LongText'>
<DisplayName>Custom DisplayName</DisplayName>
</Field>
.
.
.
</ContentType>
Will I lose existing data that I have recorded in the Description field for IPAProject?
Thanks.

No. More detail: data will not be changed.

Related

conditions for a field to appear in odoo 14

I'd like field A to appear only if field B has a given value
field B doesn't belong to the same model, it belongs to a model connected through a many2one relationship
How do I write the contents of the attrs attribute for field A in the form ?
Until now I used
<field name="A"...
attrs="{'invisible': [('B', '=', 'some_value')
But until now both A and B belonged to the same model
Field used in attrs must be present in view
You can't use dotted field names because Odoo will raise an error if the field name contain . when validating the view definition:
Invalid composed field %(definition)s in %(use)s (attrs.invisible ...)
There is an exception for list sub-views (One2many/Many2many display in a form view) where you can use parent.field_name
ok, I reply to myself
First, in the model:
field_B = field.fieldtype(related='many2one_field.field_b')
Then, in the form view:
<field name="field_B" invisible="1"/>
and then
<field name="field_A" ...
attrs="{'invisible': [('field_B', '=', 'some_value')]}">

Can't add items to Many2many in Odoo 12 EE

I defined a Many2many field for ir.attachemnt. The problem is i can' see the Add an item link to add the records.
*.py
attachment_ids = fields.Many2many('ir.attachment', string='Attachments')
*.xml
<notebook>
<page string='Attachments'>
<field name="attachment_ids"/>
</page>
</notebook>
I also tried this:
<field name="attachment_ids" widget="many2many" />
Any idea?
There is only two thing that make Odoo behave like this.
Your view is in edit mode but I think I'm seeing a place holder comments this means it's not the case
Your user is not allowed to create an ir.attachment which is more likely not the case
Your field is readonly.
If not one of this cases these is wired but if you didn't understand what happen you can force that link to appear by using embedded tree with create attribute set to true
<field..... >
<tree create='1'>
....
It'a a bug. If you have more many2many fields in the some class and for one of this you haven't right access rules, all the many2many fields are showed in readonly mode.

How to remove required field `account_id` from a `account.invoice`model in odoo

I tried removing it from the file account-> models-> account_invoice.py.
But it is showing error. So, is there any other way I can remove it from python file. How can I customize predefined model in odoo?
Definitely agree with Michele Zacceddu having the correct answer where you should be overriding the model, and updating properties on that field such as required or readonly, especially for important fields such as account_id.
But you do have the option to remove fields all together if there happens to be a scenario where you absolutely need it. You will want to make sure that you handle removing all references in the xml views and python methods to the field you are about to delete.
<record>
...
<field name="arch" type="xml">
<field name="account_id" position="replace"/>
</field>
</record>
class Invoice(models.Model):
_inherit = 'account.invoice'
def _method(self):
# override methods that reference or use the fields we
# are about to delete so that we don't break core
delattr(odoo.addons.account.models.account_invoice.AccountInvoice, 'account_id')
You can not remove fields. You can remove the required property, but not the field itself.
To do that you have to inherit account.invoice model and redefine that field.
Like:
class AccountInherit(models.Model):
_inherit = 'account.invoice'
< here define that field, it must be the same as the original but the required property >

Decimal precision in odoo

I have a problem in Odoo 9 Community Edition, I changed the decimal accuracy of the database fields to 3 as stated to below
And also the rounding in Accounting/Currencies. Everything works fine only in these two interfaces:
1: Sales orders interface
2: A sale order
The good thing is that in invoicing, everything is fine:
1: Client Invoices
2: An invoice
Is there any solution to this issue?
In Odoo 9, all the fields related to amount have changed the field type to "Monetary". Most of them are formatted using widget="monetary". In order for it to work according to the currency setting, "currency_id" field is required. Hence "currency_id" field must be included in the view. For example, in sale.order.form view
. . .
<tree string="Sales Order Lines" editable="bottom" decoration-info="invoice_status=='to invoice'">
. . .
<field name="price_subtotal" widget="monetary"/>
<field name="currency_id" invisible="1"/> <!-- Add this line -->
. . .
</tree>
The subtotal will then be formatted according to the currency of the sales order.
You go to Settings -> Technical -> Database Structure -> Decimal Accuracy then change what you want !
Odoo 14 Answer: If you want to find the "Technical" menu mentioned above, you have to enable the "Developer mode"
In order to enable it => Go in the Setting menu scroll at the end of the general settings screen. You'll find some links that will enable developer mode and then the Technical menu will appear.

OpenERP, error while creating a view filter

Im having problems with creating a filter on stock.picking object. Just recently i build a simple "privilege relay" - in each stock location you can define "Assigned User Group", thanks to that users that are in particular group can or cannot confirm moves for or out of the location.
Stock.picking:location_id -> assigned_user_group -> users
Now I would like to create a filter (later to be set default) on stock picking tree view that will show only the moves which locations (source location and destination location; i use them in stock.picking object) can be managed by a viewing user.
By far I wrote a filter that looks like that:
<record id="view_picking_internal_search_pl" model="ir.ui.view">
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_internal_search"/>
<field name="arch" type="xml">
<filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed" position="after">
<filter icon="terp-check" name="locgroup" string="Location Group" domain="[('user_id','in',[user.id for user in location_id.user_group.users])]" context="{'group_by':'date'}"/>
</filter>
</field>
</record>
I also added field location_id to the tree view.
But Im still getting an error (after choosing the filter) that even google doesnt know anything about:
TypeError: results.group_by is undefined
My questions are:
By looking on domain in filter field - what am i doing wrong?
Is something like that even possible?
I will gladly welcome any help.
Firstly, i think your domain is not correct, it could have been :
[('user_group.users.id', '=', uid)]
(because the first element of the tuple is a field on the model; and uid is a special value supplied in search views)
Next, This error :
TypeError: results.group_by is undefined
Seems to be a Javascript Error (coming from openerp-web interface), it often throws error like that when it receives unexpected values (when we make a mistake defining a view for example).
can you tell us if using the domain above solved your problem ?
NB: does your field user_group is a required field ? If not, i think the domain above won't display picking where user_group is not set, if you want to display picking where user_group is not set too, you can set a domain like that:
['|',('user_group.users.id', '=', uid), ('user_group','=',False)]
Regards