i am following the odoo 10 workflow documentation tutorial and i was unable to get any response form clicking on the workflow buttons, no error is showing.
*please note that in my code the name of the module i am developing is "testModule" which is written as "test_module" inside python instead of "openacademy" that is used in the docs tutorial. and the view file is views.xml instead of openacademy.xml , could any of that have an impact?
views.xml
...
<!-- this is the sessions views -->
<!-- session form view -->
<record model="ir.ui.view" id="session_form_view">
<field name="name">session.form</field>
<field name="model">test_module.session</field>
<field name="arch" type="xml">
<form string="Session Form">
<header>
<button name="draft" type="workflow"
string="Reset to draft"
states="confirmed,done"/>
<button name="confirm" type="workflow"
string="Confirm" states="draft"
class="oe_highlight"/>
<button name="done" type="workflow"
string="Mark as done" states="confirmed"
class="oe_highlight"/>
<field name="state" widget="statusbar"/>
</header>
...
session_workflow.xml
<odoo>
<data>
<record model="workflow" id="wkf_session">
<field name="name">OpenAcademy sessions workflow</field>
<field name="osv">test_module.session</field>
<field name="on_create">True</field>
</record>
<record model="ir.actions.server" id="set_session_to_draft">
<field name="name">Set session to Draft</field>
<field name="model_id" ref="model_test_module_session"/>
<field name="code">
model.search([('id', 'in', context['active_ids'])]).action_draft()
</field>
</record>
<record model="workflow.activity" id="draft">
<field name="name">Draft</field>
<field name="wkf_id" ref="wkf_session"/>
<field name="flow_start" eval="True"/>
<field name="kind">dummy</field>
<field name="action"></field>
<field name="action_id" ref="set_session_to_draft"/>
</record>
<record model="ir.actions.server" id="set_session_to_confirmed">
<field name="name">Set session to Confirmed</field>
<field name="model_id" ref="model_test_module_session"/>
<field name="code">
model.search([('id', 'in', context['active_ids'])]).action_confirm()
</field>
</record>
<record model="workflow.activity" id="confirmed">
<field name="name">Confirmed</field>
<field name="wkf_id" ref="wkf_session"/>
<field name="kind">dummy</field>
<field name="action"></field>
<field name="action_id" ref="set_session_to_confirmed"/>
</record>
<record model="ir.actions.server" id="set_session_to_done">
<field name="name">Set session to Done</field>
<field name="model_id" ref="model_test_module_session"/>
<field name="code">
model.search([('id', 'in', context['active_ids'])]).action_done()
</field>
</record>
<record model="workflow.activity" id="done">
<field name="name">Done</field>
<field name="wkf_id" ref="wkf_session"/>
<field name="kind">dummy</field>
<field name="action"></field>
<field name="action_id" ref="set_session_to_done"/>
</record>
<record model="workflow.transition" id="session_draft_to_confirmed">
<field name="act_from" ref="draft"/>
<field name="act_to" ref="confirmed"/>
<field name="signal">confirm</field>
</record>
<record model="workflow.transition" id="session_confirmed_to_draft">
<field name="act_from" ref="confirmed"/>
<field name="act_to" ref="draft"/>
<field name="signal">draft</field>
</record>
<record model="workflow.transition" id="session_done_to_draft">
<field name="act_from" ref="done"/>
<field name="act_to" ref="draft"/>
<field name="signal">draft</field>
</record>
<record model="workflow.transition" id="session_confirmed_to_done">
<field name="act_from" ref="confirmed"/>
<field name="act_to" ref="done"/>
<field name="signal">done</field>
</record>
<record model="workflow.transition" id="session_auto_confirm_half_filled">
<field name="act_from" ref="draft"/>
<field name="act_to" ref="confirmed"/>
<field name="condition">taken_seats > 50</field>
</record>
</data>
inculded the call in manafest.py
'data': [
# 'security/ir.model.access.csv',
'views/views.xml',
'views/templates.xml',
'views/partner.xml',
'views/session_workflow.xml',
],
created the fields and functions in my sessions model in models.py
state = fields.Selection([
('draft', "Draft"),
('confirmed', "Confirmed"),
('done', "Done"),
])
#api.multi
def action_draft(self):
self.state = 'draft'
#api.multi
def action_confirm(self):
self.state = 'confirmed'
#api.multi
def action_done(self):
self.state = 'done'
and at the end i upgraded the module
This happens with Sessions you created before implementing the session_workflow.xml
It should work fine for sessions you create after implementing the session_workflow.xml. They placed a warning for it somewhere in the middle of the example.
Warning
A workflow associated with a model is only created when the model's
records are created. Thus there is no workflow instance associated
with session instances created before the workflow's definition
I am beginner in OpenERP, I want to create a wizard to duplicate an object many time, which when i click on the button the wizard open a form the content if this form it's ( textbox + ok button) the textBox for to write how many time the wizard will call copy function to copy the object
This is my class
class immo_article(osv.osv):
_name = "immo.article"
_description = "immo article"
_columns = {
'name':fields.integer('N d inventaire',required=True , size=10),
}
_defaults = {
'date_creation': fields.date.context_today,
}
immo_article()
and this my view
<record id="immo_article_form" model="ir.ui.view">
<field name="name">immo.article.form</field>
<field name="model">immo.article</field>
<field name="arch" type="xml">
<form string="article" >
<button string="%(action_duplicate_object)d" type="action" name="duplicate.wiz"/>
<field name="name" />
</form>
</field>
</record>
<record id="immo_article_tree" model="ir.ui.view">
<record id="immo_article_tree" model="ir.ui.view">
<field name="name">immo.article.tree</field>
<field name="model">immo.article</field>
<field name="arch" type="xml">
<tree string="articles">
<field name="name" />
</tree>
</field>
</record>
<record id="immo_article_form_act" model="ir.actions.act_window">
<field name="name">Article</field>
<field name="res_model">immo.article</field>
<field name="view_mode">tree,form</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_id" ref="immo_article_tree"/>
<field name="help" type="html"></field>
</record>
and this my wizard .py
class duplicate_wiz(osv.osv_memory):
_name = 'duplicate.wiz'
_description = 'duplicate wizard'
_columns = {
'number_of_copies':fields.integer('Number of copies', size=2 , required=True),
}
_defaults = {
'number_of_copies': '0',
}
def duplicate_object(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids)[0]
article_id = context['active_id']
try:
number_of_copies = data['number_of_copies']
except:
raise osv.except_osv(_('Error'), _('Trouble!'))
return {'type': 'ir.actions.act_window_close'}
duplicate_wiz()
and this my wizard view
<record id="dup_view" model="ir.ui.view">
<field name="name">duplicate.wizard</field>
<field name="model">duplicate.wiz</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<form string="Duplicate" version="7.0">
<group col="2">
<field name="number_of_copies"/>
</group>
<footer>
<button name="duplicate_object" string="_Import" type="action" class="oe_highlight"/>
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_duplicate_object" model="ir.actions.act_window">
<field name="name">duplicater action</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">duplicate.wiz</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="dup_view"/>
</record>
</data>
I know I have many errors in wizard code, because I don't know how to it and how I can call the wizard from the button, anyone can help me with this ?
I don't have time now to read all your code, but the button on immo.article.form should have action reference in name attribute, not in string:
<button name="%(action_duplicate_object)d" type="action" string="A string"/>
I''m using OpenERP 7.0 to develop a new module. I have this workflow with two path to reach one same state "confirmed". One path is submitting a request from wich you are not responsible, thus it has to be submitted and then confirmed by the responsible person, or submit a resquest and, if you are responsible, the confirmation step is skipped and goes directly to the "confirmed" case. When I try to send the request to be treated , it work if the process came from the first path (through confirmation) and doesn't if it went directly from "draft" to "confirmed".
Here is a screenshot of the workflow
My workflow definition:
<?xml version="1.0"?>
<openerp>
<data>
<record model="workflow" id="wkf_request">
<field name="name">request.wkf</field>
<field name="osv">generic.request</field>
<field name="on_create">True</field>
</record>
<!-- actividades -->
<record model="workflow.activity" id="act_draft">
<field name="wkf_id" ref="wkf_request" />
<field name="flow_start">True</field>
<field name="name">request_draft</field>
<field name="kind">function</field>
<field name="action">request_draft()</field>
</record>
<record model="workflow.activity" id="act_submit">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_submitted</field>
<field name="kind">function</field>
<field name="action">submit_request()</field>
</record>
<record model="workflow.activity" id="act_confirm">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_confirmed</field>
<field name="kind">function</field>
<field name="action">confirm_request()</field>
</record>
<record model="workflow.activity" id="act_closed_nconf">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_closed_nconf</field>
<field name="kind">function</field>
<field name="action">close_nconf_request()</field>
<field name="flow_stop">True</field>
</record>
<record model="workflow.activity" id="act_req_reformulate">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_reformulation</field>
<field name="kind">function</field>
<field name="action">req_reformulate_request()</field>
</record>
<record model="workflow.activity" id="act_treatment">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_treatment</field>
<field name="kind">function</field>
<field name="action">tratamento()</field>
</record>
<record model="workflow.activity" id="act_closed">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_closed</field>
<field name="kind">function</field>
<field name="action">close_request()</field>
<field name="flow_stop">True</field>
</record>
<!-- transições -->
<record model="workflow.transition" id="request_t1">
<field name="act_from" ref="act_draft" />
<field name="act_to" ref="act_submit" />
<field name="signal">submit_request</field>
</record>
<record model="workflow.transition" id="request_t101">
<field name="act_from" ref="act_draft" />
<field name="act_to" ref="act_confirm" />
<field name="signal">confirm_request</field>
</record>
<record model="workflow.transition" id="request_t2">
<field name="act_from" ref="act_submit" />
<field name="act_to" ref="act_req_reformulate" />
<field name="signal">req_reformulate_request</field>
</record>
<record model="workflow.transition" id="request_t3">
<field name="act_from" ref="act_req_reformulate" />
<field name="act_to" ref="act_submit" />
<field name="signal">submit_request</field>
</record>
<record model="workflow.transition" id="request_t4">
<field name="act_from" ref="act_submit" />
<field name="act_to" ref="act_confirm" />
<field name="signal">confirm_request</field>
</record>
<record model="workflow.transition" id="request_t5">
<field name="act_from" ref="act_submit" />
<field name="act_to" ref="act_closed_nconf" />
<field name="signal">close_nconf_request</field>
</record>
<record model="workflow.transition" id="request_t6">
<field name="act_from" ref="act_confirm" />
<field name="act_to" ref="act_treatment" />
<field name="signal">tratamento</field>
</record>
<record model="workflow.transition" id="request_t7">
<field name="act_from" ref="act_treatment" />
<field name="act_to" ref="act_closed" />
<field name="signal">close_request</field>
</record>
</data>
</openerp>
Button in the view definition:
<button name="tratamento" class="oe_highlight oe_view_mode_only" string="Send to processing!" type="workflow" states="confirmed" />
And finaly, here is the code of the relevant funcions in my py object
def request_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'draft'})
self.insert_trace(cr, uid, ids, context)
return True
def submit_request(self, cr, uid, ids, context=None):
resp = self.browse(cr,uid,ids,context)
if resp[0].needs_reformulation:
self.write(cr, uid, ids, {'needs_reformulation': False, 'reformulation_info': ''}) #clean up reformulation settings
if resp[0].goto:
self.write(cr, uid, ids, {'goto':'','state': resp[0].goto}) # if request is already in motion, clean up the goto tag and go to where it came from
elif resp[0].is_responsible: # else check if requestor is responsible
self.write(cr, uid, ids, {'state': 'confirmed'})
else: # if not
self.write(cr, uid, ids, {'state': 'submitted'})
self.insert_trace(cr, uid, ids, context)
return True
def confirm_request(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'confirmed'})
self.insert_trace(cr, uid, ids, context)
return True
(...)
# this function works when state is confirmed and came through confirmation, and doesn't when requestor is responsible and is directly confirmed
def tratamento(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'treatment'})
self.insert_trace(cr, uid, ids, context)
return True
def close_request(self, cr, uid, ids, context=None):
req = self.browse(cr, uid, ids, context=context)
if(req[0].authorized): #check if request has been authorized
self.write(cr, uid, ids, {'state': 'closed_auth'})
elif(req[0].approved): #or approved
self.write(cr, uid, ids, {'state': 'closed_appr'})
else: #if not, simply close the request!
self.write(cr, uid, ids, {'state': 'closed'})
self.insert_trace(cr, uid, ids, context)
return True
Anyone has any clue of what is causing this? Thanks in advance!
It wasn't working because I was jumping to that state through a "shortcut" in my python code, bypassing a workflow transition.
To solve this I added some conditions to the workflow (and thus some new transitions) and now it is working fine.
Since I find that OpenERP documentation is so poor, I'll let here my solution, hoping this will eventually help someone in the future.
Workflow screenshot:
Workflow definition:
<?xml version="1.0"?>
<openerp>
<data>
<record model="workflow" id="wkf_request">
<field name="name">request.wkf</field>
<field name="osv">generic.request</field>
<field name="on_create">True</field>
</record>
<!-- actividades -->
<record model="workflow.activity" id="act_draft">
<field name="wkf_id" ref="wkf_request" />
<field name="flow_start">True</field>
<field name="name">request_draft</field>
<field name="kind">function</field>
<field name="action">request_draft()</field>
</record>
<record model="workflow.activity" id="act_submit">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_submitted</field>
<field name="kind">function</field>
<field name="action">submit_request()</field>
</record>
<record model="workflow.activity" id="act_confirm">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_confirmed</field>
<field name="kind">function</field>
<field name="action">confirm_request()</field>
</record>
<record model="workflow.activity" id="act_closed_nconf">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_closed_nconf</field>
<field name="kind">function</field>
<field name="action">close_nconf_request()</field>
<field name="flow_stop">True</field>
</record>
<record model="workflow.activity" id="act_req_reformulate">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_reformulation</field>
<field name="kind">function</field>
<field name="action">req_reformulate_request()</field>
</record>
<record model="workflow.activity" id="act_treatment">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_treatment</field>
<field name="kind">function</field>
<field name="action">treat_request()</field>
</record>
<record model="workflow.activity" id="act_closed">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_closed</field>
<field name="kind">function</field>
<field name="action">close_request()</field>
<field name="flow_stop">True</field>
</record>
<record model="workflow.activity" id="act_awaiting_auth">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_awaiting_authorization</field>
<field name="kind">function</field>
<field name="action">wait_auth_request()</field>
</record>
<record model="workflow.activity" id="act_closed_ref">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_closed_ref</field>
<field name="kind">function</field>
<field name="action">close_ref_request()</field>
<field name="flow_stop">True</field>
</record>
<record model="workflow.activity" id="act_awaiting_appr">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_awainting_approval</field>
<field name="kind">function</field>
<field name="action">wait_appr_request()</field>
</record>
<record model="workflow.activity" id="act_closed_disappr">
<field name="wkf_id" ref="wkf_request" />
<field name="name">request_closed_disappr</field>
<field name="kind">function</field>
<field name="action">close_disappr_request()</field>
<field name="flow_stop">True</field>
</record>
<!-- transições -->
<record model="workflow.transition" id="request_t1">
<field name="act_from" ref="act_draft" />
<field name="act_to" ref="act_submit" />
<field name="signal">submit_request</field>
</record>
<!-- this transition appens when condition is satisfied (function returns true if requestor is responsible) -->
<record model="workflow.transition" id="request_t102">
<field name="act_from" ref="act_submit" />
<field name="act_to" ref="act_confirm" />
<field name="condition">check_responsible()</field>
</record>
<record model="workflow.transition" id="request_t2">
<field name="act_from" ref="act_submit" />
<field name="act_to" ref="act_req_reformulate" />
<field name="signal">req_reformulate_request</field>
</record>
<record model="workflow.transition" id="request_t3">
<field name="act_from" ref="act_req_reformulate" />
<field name="act_to" ref="act_submit" />
<field name="signal">submit_request</field>
</record>
<record model="workflow.transition" id="request_t1001">
<field name="act_from" ref="act_submit" />
<field name="act_to" ref="act_confirm" />
<field name="condition">ref_goto_confirmed()</field>
</record>
<record model="workflow.transition" id="request_t1002">
<field name="act_from" ref="act_submit" />
<field name="act_to" ref="act_treatment" />
<field name="condition">ref_goto_treatment()</field>
</record>
<record model="workflow.transition" id="request_t4">
<field name="act_from" ref="act_submit" />
<field name="act_to" ref="act_confirm" />
<field name="signal">confirm_request</field>
</record>
<record model="workflow.transition" id="request_t5">
<field name="act_from" ref="act_submit" />
<field name="act_to" ref="act_closed_nconf" />
<field name="signal">close_nconf_request</field>
</record>
<record model="workflow.transition" id="request_t6">
<field name="act_from" ref="act_confirm" />
<field name="act_to" ref="act_treatment" />
<field name="signal">treat_request</field>
</record>
<record model="workflow.transition" id="request_t7">
<field name="act_from" ref="act_treatment" />
<field name="act_to" ref="act_closed" />
<field name="signal">close_request</field>
</record>
<record model="workflow.transition" id="request_t8">
<field name="act_from" ref="act_treatment" />
<field name="act_to" ref="act_awaiting_auth" />
<field name="signal">wait_auth_request</field>
</record>
<record model="workflow.transition" id="request_t9">
<field name="act_from" ref="act_awaiting_auth" />
<field name="act_to" ref="act_closed_ref" />
<field name="signal">close_ref_request</field>
</record>
<record model="workflow.transition" id="request_t10">
<field name="act_from" ref="act_awaiting_auth" />
<field name="act_to" ref="act_treatment" />
<field name="signal">auth_send_processing</field>
</record>
<record model="workflow.transition" id="request_t11">
<field name="act_from" ref="act_treatment" />
<field name="act_to" ref="act_req_reformulate" />
<field name="signal">req_reformulate_request</field>
</record>
<record model="workflow.transition" id="request_t12">
<field name="act_from" ref="act_treatment" />
<field name="act_to" ref="act_awaiting_appr" />
<field name="signal">wait_appr_request</field>
</record>
<record model="workflow.transition" id="request_t13">
<field name="act_from" ref="act_awaiting_appr" />
<field name="act_to" ref="act_closed_disappr" />
<field name="signal">close_disappr_request</field>
</record>
<record model="workflow.transition" id="request_t14">
<field name="act_from" ref="act_awaiting_appr" />
<field name="act_to" ref="act_treatment" />
<field name="signal">appr_send_processing</field>
</record>
</data>
</openerp>
Relevant python code:
def request_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'draft'})
self.insert_trace(cr, uid, ids, context)
return True
# workflow condition returns true if requestor is responsible
def check_responsible(self, cr, uid, ids, context=None):
return self.browse(cr, uid, ids, context)[0].is_responsible
# next two functions are also workflow conditions
def ref_goto_confirmed(self, cr, uid, ids, context=None):
req = self.browse(cr, uid, ids, context)
if req[0].needs_reformulation and req[0].goto == 'confirmed':
self.write(cr, uid, ids, {'needs_reformulation': False, 'reformulation_info': ''}) #clean up reformulation settings
self.write(cr, uid, ids, {'goto':'','state': 'confirmed'}) # if request is already in motion, clean up the goto tag and go to where it came from
return True
return False
def ref_goto_treatment(self, cr, uid, ids, context=None):
req = self.browse(cr, uid, ids, context)
if req[0].needs_reformulation and req[0].goto == 'treatment':
self.write(cr, uid, ids, {'needs_reformulation': False, 'reformulation_info': ''}) #clean up reformulation settings
self.write(cr, uid, ids, {'goto':'','state': 'treatment'}) # if request is already in motion, clean up the goto tag and go to where it came from
#self.insert_trace(cr, uid, ids, context)
return True
return False
def confirm_request(self, cr, uid, ids, context=None):
resp = self.browse(cr,uid,ids,context)
self.write(cr, uid, ids, {'state': 'confirmed'})
self.insert_trace(cr, uid, ids, context)
return True
def submit_request(self, cr, uid, ids, context=None):
req = self.browse(cr,uid,ids,context)
if req[0].needs_reformulation:
if req[0].goto == 'submitted':
self.write(cr, uid, ids, {'needs_reformulation': False, 'reformulation_info': ''}) #clean up reformulation settings
self.write(cr, uid, ids, {'goto':'','state': 'submitted'})
self.insert_trace(cr, uid, ids, context)
return True
return False
else:
self.write(cr, uid, ids, {'state': 'submitted'})
self.insert_trace(cr, uid, ids, context)
return True
def close_nconf_request(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'closed_nconf'})
self.insert_trace(cr, uid, ids, context)
return True
def req_reformulate_request(self, cr, uid, ids, context=None):
req = self.browse(cr, uid, ids, context=context)
goto = req[0].state
if goto:
self.write(cr, uid, ids, {'goto': goto, 'state': 'req_reformulation', 'needs_reformulation': True} )
else:
self.write(cr, uid, ids, {'state': 'req_reformulation', 'needs_reformulation': True})
self.insert_trace(cr, uid, ids, context)
return True
Hope this will help someone! :)
I'm new to OpenErp.
I want to Add a new field "mother_name" in res.partner.So i have added the following code to res.partner.py
In column's i have add like this
_columns = {
'name': fields.char('Name', size=128, required=True, select=True),
'date': fields.date('Date', select=1),
'title': fields.many2one('res.partner.title', 'Title'),
'parent_id': fields.many2one('res.partner', 'Related Company'),
'child_ids': fields.one2many('res.partner', 'parent_id', 'Contacts', domain=[('active','=',True)]), # force "active_test" domain to bypass _search() override
'ref': fields.char('Reference', size=64, select=1),
'date_delivery': fields.date('Expected Delivery Date'),
'mother_ln': fields.char('Mother', size=64),
.
.
.
}
Now in res_partner_view.xml . I'm using the following code
<record id="view_partner_tree" model="ir.ui.view">
<field name="name">res.partner.tree</field>
<field name="model">res.partner</field>
<field eval="8" name="priority"/>
<field name="arch" type="xml">
<tree string="Contacts">
<field name="name"/>
<field name="function" invisible="1"/>
<field name="phone"/>
<field name="email"/>
<field name="user_id" invisible="1"/>
<field name="is_company" invisible="1"/>
<field name="country" invisible="1"/>
<field name="country_id" invisible="1"/>
<field name="date_delivery"/>
<field name="mother_ln"/>
<field name="parent_id" invisible="1"/>
</tree>
</field>
</record>
<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field eval="1" name="priority"/>
<field name="arch" type="xml">
<form string="Partners" version="7.0">
<sheet>
<field name="image" widget='image' class="oe_left oe_avatar" options='{"preview_image": "image_medium", "size": [90, 90]}'/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/> (
<field name="is_company" on_change="onchange_type(is_company)" class="oe_inline"/> <label for="is_company" string="Is a Company?"/>)
</div>
<h1>
<field name="name" default_focus="1" placeholder="Name" />
</h1>
<field name="parent_id"
placeholder="Company"
domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'default_supplier': supplier}"
attrs="{'invisible': [('is_company','=', True),('parent_id', '=', False)]}"
on_change="onchange_address(use_parent_address, parent_id)"/>
<!-- <field name="category_id" widget="many2many_tags" placeholder="Tags..."/> -->
</div>
<div class="oe_right oe_button_box" name="buttons"> </div>
<group>
<group>
<label for="type" attrs="{'invisible': [('parent_id','=', False)]}"/>
<div attrs="{'invisible': [('parent_id','=', False)]}" name="div_type">
<field class="oe_inline"
name="type"/>
</div>
<label for="street" string="Address"/>
<div>
<field name="use_parent_address" class="oe_edit_only oe_inline"
on_change="onchange_address(use_parent_address, parent_id)"
attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"/>
<label for="use_parent_address" class="oe_edit_only" attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"/>
<button name="open_parent" type="object" string="(edit company address)" class="oe_link oe_edit_only"
attrs="{'invisible': ['|',('parent_id','=', False),('use_parent_address','=',False)]}"/>
<field name="street" placeholder="Street..." attrs="{'readonly': [('use_parent_address','=',True)]}"/>
<field name="street2" attrs="{'readonly': [('use_parent_address','=',True)]}"/>
<div class="address_format">
<field name="city" placeholder="City" style="width: 40%%" attrs="{'readonly': [('use_parent_address','=',True)]}"/>
<field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": True}' on_change="onchange_state(state_id)" attrs="{'readonly': [('use_parent_address','=',True)]}"/>
<field name="zip" placeholder="ZIP" style="width: 20%%" attrs="{'readonly': [('use_parent_address','=',True)]}"/>
</div>
<field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}' attrs="{'readonly': [('use_parent_address','=',True)]}"/>
</div>
</group>
<group>
<!-- We Don't require Job Position for Customer -->
<!-- <field name="function" placeholder="e.g. Sales Director"
attrs="{'invisible': [('is_company','=', True)]}"/> -->
<field name="phone" placeholder="e.g. +32.81.81.37.00"/>
<field name="mobile"/>
<field name="fax"/>
<field name="email" widget="email"/>
<!-- <field name="title" domain="[('domain', '=', 'contact')]"
options='{"no_open": True}' attrs="{'invisible': [('is_company','=', True)]}" /> -->
</group>
<field name="date_delivery"/>
<field name="mother_ln"/>
</group>
.
.
.
</record>
Better is you inherit that code and add your field rather doing changes to main code.
for your py file
class res_partner(osv.osv):
_inherit= 'res.partner'
_columns = {
'mother_ln': fields.char('Mother', size=64),
'father_name': fields.char('Father', size=64),
# this is comment. -> you can add as many types of fields as you want - eg. char ,
# boolean, float, integer, one2many, many2one etc.
}
res_partner()
for your xml file :-
<record id="view_res_partner_inherited" model="ir.ui.view">
<field name="name">view.res.partner.inherited</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="date_delivery" position="after">
<field name="mother_ln" />
<field name="father_name" />
<!--comment- likewise this is your view, add all your fields here in view -->
</field>
</field>
</record>