How to appear TIN field CRM module in odoo10? - odoo

I am new user of odoo10 development.I want to appear TIN field in CRM module for odoo10. How should I do? In odoo11, TIN field is already appeared in CRM module.

The Tax Identification Number TIN is a base field named "vat" in res.partner model in both Odoo 10 and 11. It is specified in Odoo 11 res.partner form view but not in Odoo 10. This is why it is not visible in 10.
You can make a modification yourself to the Odoo 10 form by adding the field. You can add it the same way it is done in Odoo 10:
<field name="vat" placeholder="e.g. BE0477472701"/>
Note that the field name is "vat" and the field caption is "TIN". The right way to make modifications to Odoo base views is to inherit from them, not to modify directly them. If you modify them directly, your modifications will be overridden when you update Odoo.

Related

How do I get a field in odoo 15 from res.partner module shown in account.move?

In odoo 15 I have created a PDF report for invoices using a custom layout via an external module. The address of the customer is specified at the top left of the first page of the PDF report. The content comes from the record that was created via "Customer" (res.partner) and selected via the field "partner_id". After the selection, the street and postal code as well as city are loaded in the edit view of an invoice and thus transferred to the PDF document.
How can I extend or overwrite the address field in my custom report layout to create an own address field that comes from the customer data (model res.partner)? I have created an additional field there via a module (address_suffix) that can store an address addition. I would like to be able to include this custom field of res.partner in the address field at account.move and in the end into the PDF report.
To illustrate it:
I want this field (address_suffix in res.partner)
can be seen here (account.move):
You can check the OCA partner_address_street3 module. It is similar to yours, it adds a third street field (street3) to store additional address information.
The module extends the address format, so it should automatically show on reports
On your report xm, I think you can try using t-field and using widget contact inside the t-options tag.
Example:
<span t-field="partner_id" t-options='{"widget": "contact", "fields": ["address"]}'/>

Modifying Domain of Many2One using Many2Many

Just to preface, I'm using Odoo 10 Enterprise.
I have a custom module with the following (these are just the relevant fields) on its form:
orange_tag_id = This is a Many2Many field with the _Checkboxes widget defined that's connected to a Tags module (we'll just call it orange.tags). This field displays six or seven tags I've created and then applied to various products within the 'product.product/template' module.
orange_child_ids = This is just a One2Many within a child module of the parent module. This lists a product_tmpl_id Many2One and then a read-only copy of orange_tag_id from the parent that just copies whatever is selected in orange_tag_id in the parent form (this was created just in case defining parent.orange_tag_id in the domain didn't work).
When a tag is selected from the orange_tag_id checkbox, it should sort of modify the domain of product_tmpl_id in orange_child_ids and then only display the products in the drop-down display that have been tagged with the selected active tag. I've managed to get this sort of working by just adding the following to the form XML view within orange_child_ids:
<field name="product_tmpl_id" domain="[('orange_tag_id.id','in',parent.orange_tag_id[0])]"/>
This will display only the products that have been tagged with the selected tag with one exception: Tag6's products (just calling it this because its ID was 6) will always display in the drop-down regardless of whether it's selected or not. If Tag2 is selected, then Tag2 and Tag6's products will display. I tried removing Tag6 from any products that had it defined, then deleting the Tag6 record, re-creating the tag, and re-applying it to the relevant products, but the issue persists. I also can only select one tag in the checkbox -- if more than one is selected, I get the following error from product_tmpl_id:
TypeError: not all arguments converted during string formatting
This isn't as big of a deal as not having the correct records displaying, but I'd also like to resolve this, but I'm not entirely sure how.
I've searched for hours and am aware of methods where this can be done in self-hosted installations, however, we're using Odoo 10 Enterprise (I've omitted the required x_ in my aforementioned custom fields just for easier readability), and I have no access to the file system and consequently can't make modifications where that's required. I've been trying to figure this out using just the Developer Tools and my administrative access to the database's settings.
I've messed around a lot with the domain, looked through many questions and forum threads, and what I have was the only thing that worked. Is there any way to get this working correctly within the limitations of Enterprise?
Much obliged.
It appears that adding [2] after the [0] makes everything work and resolves the two issues I was having, so:
<field name="product_tmpl_id" domain="[('orange_tag_id.id','in',parent.orange_tag_id[0][2])]"/>
This will filter the results of the Many2One based on the records selected in the Many2Many field.
While [('orange_tag_id.id','in',parent.orange_tag_id[0][2])] will work, it is extremely obscure.
I advise you to go with [('orange_tag_id.id','in',parent.orange_tag_id.ids)]

Adding new field on Odoo Product Variant

I am trying to add new field to product.product model.
What I've done so far is:
Add new field on the following model (From Settings > Database Structure > Models):
product.product
with the following details:
Name: x_product_cost
Field Label: Product Cost
Field Type: Float
and leave the rest to default.
The problem is i am unable to show it on the form. This is the only code that is generated when I tried to edit Form:
View Name: product.product.form
Object: product.product
Inherited View: product.template.common.form
Product Variant
lst_price
I can't use product.template model, since that inherits to product.product
Am i missing something here?
PS: I am trying to temporarily fixed assign-different-cost-on-product-variant bug as specified here
https://github.com/odoo/odoo/issues/1198
Can anyone help me with this?
Actually instead of modifying the model from the Odoo configuration, you should create a custom module, in which you will add the new fields and the new behaviors that you need.
To do so you will have to inherit from the models in the python files to extend them, and you will surely have to modify the views as well, so that your custom fields get displayed.
For reference on how to extend models, create a custom module and create the views, you should refer to the Odoo documentation that you can find here.
As an additional note in case you didn't know, but their is a new API that appeared in the version 8 of Odoo, if you can use it, it is much easier and much nicer.

How use a fields of module A in module B

i have two module opportunities and job positions .
i am trying to use only one field of "job positions" name Employees in "opportunities" module.
i am new in openerp and have no knowledge about python . so i am using developer option of openerp . i am attaching my both module file .
Is there any attribute of fields or other so my field will use the value of other module values like as :-
crm.lead xml file:-
<field name="name" module="hr.job" />
here module is not using value of "hr.job" and using of "crm.lead" value.
if i used other name it give me "not field found" error.
please expert help me
You seem pretty confused. What you've attached are view files for your modules, for instance one of them is the form view for object named hr.job. This is not as you call it "module files".
What you need to do is create a many2one (or many2many) field from the referenced object you want to the target object you need, meaning adding a field to whatever class's columns you need in the corresponding py file and not view. A very simple example for a class named opportunity_opportunity:
class opportunity_opportunity (osv.osv):
_name = "opportunity.opportunity"
_columns = {
'name' : fields.char('Name', size=64),
'employee_id': fields.many2one('job.position','name')
}
opportunity_opportunity()
you can later add it in the opportunity_view.xml file as any other field:
<field name="employee_id" string="Employee"/>
More importantly, I think you need to seriously first read and understand the developer book: OpenERP 6.1 Developer Book
EDIT: I just noticed you had already posted the same question yesterday here link, this is very frowned upon in stackoverflow. Please take your time to read the openerp documentation before posting questions.

Modifying one of OpenERP's core fields using a custom module

Sometimes our OpenERP users want to make a small change to a field in a core OpenERP module. For example, they want the product screen's Rack, Row, and Case fields to be longer than 16 characters.
Can I change an existing field without making changes to the module that declared it? I'd rather make the changes using our own custom module, instead of editing the product module itself.
I've got this working, but I'm hoping that someone else knows a cleaner way.
You can inherit the core module's class in your custom module, and then just declare a new field with the same name as the one you want to change. Essentially, just copy the field declaration from the core module, paste it into your custom module, and then make the changes you want. For example, our product_notes module widened the Rack, Row, and Case fields to 255 from the product module's 16.
_columns = {'loc_rack': fields.char('Rack', size=255),
'loc_row': fields.char('Row', size=255),
'loc_case': fields.char('Case', size=255)}
The reason I don't like this is that you now have duplication for all the other attributes of the field. If you change the field length, and then the core module changes the help text, you will still have the old help text. I was hoping that there would be some way when the modules are loading to go in and adjust the field attributes of your parent, but I couldn't find any hooks at the right time.
One change that you can make more easily is the default value of a field. Just declare a default value for a core module's field in your custom module, and it will replace the original default. For example, we changed the defaults for sale_delay and produce_delay from those in the product module.
_defaults = {'sale_delay': lambda *a: 5,
'produce_delay': lambda *a: 0}
In ODOO we can change any attribute of a field using xml.
<field name="loc_rack" position="attributes">
<attribute name="string">Axis</attribute>
</field>
But some case like extending the size of a field its failed.
You need to inherit the product form.
Here you go.
from openerp.osv import fields, osv
class product_product(osv.Model) # <<<v7
_inherit = 'product.product'
_columns = {
'loc_rack': fields.char('Rack', size=<your size>),
'loc_row': fields.char('Row', size=<your size>),
'loc_case': fields.char('Case', size=<your size>)
}
In simple words you just need to override the field and apply your attribute changes it will reflect.