In Odoo 8, we could import CSV data for "Account moves" and "Account move lines".
I'm migrating to Odoo 10 : i found how to import "Account moves" but where can i import the line of my moves (there's no "Import" button on the view of Account move lines) ?
Thanx.
Christophe
In account.move.line default tree view create='false' is set.
If in tree view create='false' is set then odoo will hide Create and Import button.
The following is odoo default view.
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>
<field eval="1" name="priority"/>
<field name="arch" type="xml">
<tree string="Journal Items" create="false">
<field name="date"/>
<field name="move_id" required="0"/>
<field name="journal_id" options='{"no_open":True}'/>
<field name="name"/>
<field name="ref"/>
<field name="statement_id" invisible="1"/>
<field name="partner_id"/>
<field name="account_id" options='{"no_open":True}' domain="[('company_id', '=', company_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="reconciled" invisible="1"/>
<field name="full_reconcile_id"/>
<field name="debit" sum="Total Debit"/>
<field name="credit" sum="Total Credit"/>
<field name="amount_currency" readonly="True" groups="base.group_multi_currency"/>
<field name="currency_id" readonly="True" invisible="1" />
<field name="date_maturity"/>
<field name="company_currency_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</tree>
</field>
</record>
You can override above Tree view in your module and remove create='false'.
<record id="account.view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>
<field eval="1" name="priority"/>
<field name="arch" type="xml">
<tree string="Journal Items">
<field name="date"/>
<field name="move_id" required="0"/>
<field name="journal_id" options='{"no_open":True}'/>
<field name="name"/>
<field name="ref"/>
<field name="statement_id" invisible="1"/>
<field name="partner_id"/>
<field name="account_id" options='{"no_open":True}' domain="[('company_id', '=', company_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="reconciled" invisible="1"/>
<field name="full_reconcile_id"/>
<field name="debit" sum="Total Debit"/>
<field name="credit" sum="Total Credit"/>
<field name="amount_currency" readonly="True" groups="base.group_multi_currency"/>
<field name="currency_id" readonly="True" invisible="1" />
<field name="date_maturity"/>
<field name="company_currency_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</tree>
</field>
</record>
After that You can import CSV file.
You can import account.move.line & account.move in same file, I have attached import format.
You can export any existing account move from Action in tree view and select all required field.Just export it.
If you want to import account.move.line and account.move using different file then you must inherit account.move.line create method and set check_move_validity is False.
if self._context.get('check_move_validity', True):
move.with_context(context)._post_validate()
Above condition is odoo base module account.move.line create method condtion.When account.move.line is create at that time system is checking if check_move_validity is False then system will not try to reconcile single move line.
You need to inherit create and write method in custom module,after that line by line import work as well.
#api.model
def create(self, vals):
move_line = super(AccountMoveLine, self.with_context(check_move_validity=False)).create(vals)
return move_line
#api.multi
def write(self, vals):
move_line = super(AccountMoveLine, self.with_context(check_move_validity=False)).write(vals)
return move_line
This may help you.
for information i am on odoov11.0c
all is based on ids,when you import data remember that account_account account_move and account_move_line are linked and see terms used directly on model class
from an xls files you can import from the standard menu account_move and account move line using those first line cells name:
Journal
Date
id
line_ids/partner_id
Number
reference
line_ids/debit
line_ids/credit
narration
line_ids/matching_number/Number
line_ids/due date
line_ids/counterpart
line_ids/account_id
Status
Hope this help
Related
I am very new in odoo and i really need your help.
I've extended res.partner :
class extendedPartner(models.Model):
_name = 'extended.partner'
_inherit = 'res.partner'
auto = fields.One2Many('partner.car', 'auto_name', 'Car', required=False)
class partnerCar(models.Model):
_name = 'partner.car'
auto_model = fields.Char('Model auto', size=20, required=True)
release = fields.Integer('Year of release', required=True)
auto_name = fields.Many2One('extended.partner', 'Car Name', required=True)
But I don't know how to write xml so that I could see all partner's cars and information about them
<record model="ir.ui.view" id="view_partner_form">
<field name="name">res.partner.form.inherit</field>
<field name="model">extended.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Cars">
<!-- what should I write here? -->
</page>
</notebook>
</field>
</record>
Could you please help me? Thank you in advance.
UPD:
Is it right solution?
<record model="ir.ui.view" id="view_partner_form">
<field name="name">res.partner.form.inherit</field>
<field name="model">extended.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="auto">
<tree>
<field name="auto_name"/>
<field name="auto_model"/>
<field name="release"/>
</tree>
</field>
</field>
</record>
You are almost there, since you inherit from another view and you injecting your view into the view you inherit from, you need to give your new view a "hook" in the parent view which it can use to attach its contents. So you use an xpath expression, and then you insert your field.
When you insert a relational field you can create so called embedded views. Here you have defined a tree view for your field. That means whenever your field will be rendered as a tree that is the tree that will be used, in your case the form.
You could also create a <form> after <tree> to be shown when clicked.
<record model="ir.ui.view" id="view_partner_form">
<field name="name">res.partner.form.inherit</field>
<field name="model">extended.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="insert_x_path_xpression here" position="after, before etc"
<field name="auto">
<tree>
<field name="auto_name"/>
<field name="auto_model"/>
<field name="release"/>
</tree>
</field>
</xpath>
</field>
</record>
I'm new to Odoo and I'm looking for a way to add/edit columns in the overview of customer invoices.
Does anyone know which files to edit? Or how this "overview screen" is called so I can look it up better?
Link to screenshot of overview screen: http://oi58.tinypic.com/2prtyk0.jpg
Thanks in advance!
The VIEW of this "TREE" is defined in
addons/account/views/account_invoice_view.xml
Which has the code like this:
<record id="invoice_tree" model="ir.ui.view">
<field name="name">account.invoice.tree</field>
<field name="model">account.invoice</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" string="Invoice">
<field name="partner_id" groups="base.group_user" string="Customer"/>
<field name="date_invoice"/>
<field name="number"/>
<field name="commercial_partner_id" invisible="1"/>
<field name="reference" invisible="1"/>
<field name="name" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
<field name="user_id"/>
<field name="date_due"/>
<field name="origin"/>
<field name="amount_total_signed" sum="Total Amount"/>
<field name="residual_signed" sum="Residual Amount"/>
<field name="currency_id" invisible="1"/>
<field name="company_currency_id" invisible="1"/>
<field name="state"/>
<field name="type" invisible="context.get('type',True)"/>
</tree>
</field>
</record>
I recommend you use developer mode to know the name of the view what you want change/edit/inherit/..etc,
Go to Administrator => About Odoo => Activate Developer Mode then return to the view and you will see near to the name of the current view a Drop-down list with name Debug View#xx click there and choice Edit TreeView/FormView/...etc after that you are going to see the definition of the current view, in this way you will know what view you need to inherit/edit/..etc
I hope this will help you!
The way stock.picking.in is implemented in openERP is interesting. I am trying to do something similar with purchase orders.
Stock.picking.in inherits from stock.picking, customizes a few columns and defaults and declares the table as stock_picking. On the UI side, a form view is inherited from view_picking_form and the model used is stock.picking.in.
I am trying to do something similar by creating a special purchase order. The problem is that the form for the special PO never gets picked up. It always shows a dynamic view with all fields of the PO dumped in some default manner. The developer mode also does not show the right form view.
When I check Settings -> User Interface -> Views, it does show the view properly but doesn't display it when I create new special PO.
Here is the code:
class my_purchase_order(osv.osv):
_name = "purchase.order"
_inherit = "purchase.order"
_columns={
...
}
my_purchase_order()
class my_purchase_order_special(osv.osv):
_name = 'purchase.order.my_special'
_inherit = "purchase.order"
_table = "purchase_order"
_columns = {...
}
my_purchase_order_special()
<record id="po_my_special_form" model="ir.ui.view">
<field name="name">po_my_special_form</field>
<field name="model">purchase.order.my_special</field>
<field name="type">form</field>
<field name="inherit_id" ref="purchase.purchase_order_form" />
<field name="arch" type="xml">
...
</field>
</record>
<record id="po_my_special_tree" model="ir.ui.view">
<field name="name">po_my_special_tree</field>
<field name="model">purchase.order.my_special</field>
<field name="arch" type="xml">
<tree fonts="bold:message_unread==True" colors="grey:state=='cancel';blue:state in ('wait','confirmed');red:state in ('except_invoice','except_picking')" string="Purchase Order">
<field name="message_unread" invisible="1"/>
<field name="name" string="Reference"/>
<field name="date_order" />
<field name="partner_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="minimum_planned_date" invisible="context.get('quotation_only', False)"/>
<field name="origin"/>
<field name="amount_untaxed" sum="Total Untaxed amount" string="Untaxed"/>
<field name="amount_total" sum="Total amount"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="action_po_my_special_tree" model="ir.actions.act_window">
<field name="name">Special Purchase Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order.my_special</field>
<field name="view_mode">tree,form,graph,calendar</field>
<field name="context">{}</field>
<field name="domain">[('state','=','draft')]</field>
<field name="search_view_id" ref="purchase.view_purchase_order_filter"/>
</record>
<record id="action_po_my_special_form" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="po_my_special_form"/>
<field name="act_window_id" ref="action_po_my_special_tree"/>
</record>
Please advise. Thanks in advance.
Turns out I was missing view records:
<record id="action_po_my_special_tree2" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="po_my_special_tree"/>
<field name="act_window_id" ref="action_po_my_special_tree"/>
</record>
<record id="action_po_my_special_form2" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="po_my_special_form"/>
<field name="act_window_id" ref="action_po_my_special_tree"/>
</record>
with following code I could able to insert/edi trecord without any issue. My form view displays all fields except 'rate' which is selection field. Also tree view shows rate field as undefined. My database holds correct value for rate field. May I know the root cause for this and how to overcome this issue.
.py file is given here
from osv import osv
from osv import fields
class test_base(osv.osv):
_name='test.base'
_columns={
'name':fields.char('Name'),
'email':fields.char('Email'),
'code':fields.integer('Unique ID'),
sal':fields.float('Salary'),
'rate':fields.selection(((10,'10'), (20,'20'),(30,'30')),
'Percentage of Deduction'),
'ded':fields.float('Deduction'),
'bdisplay':fields.float('Button Display'),
}
def on_change_ded_cal(self, cr, uid, ids,rate,context=None):
x=rate*2
return {'value':{'ded':x }}
test_base()
My XML is
<record model="ir.ui.view" id="test_base_form">
<field name="name">test.base.form</field>
<field name="model">test.base</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Test Base">
<field name="name"/>
<field name="email"/>
<field name="code"/>
<field name="sal"/>
<field name="rate" on_change="on_change_ded_cal(rate,sal,ded)"/>
<field name="ded"/>
<field name="bdisplay"/>
<button name="my_button_display" string="Calculate" type="object"/>
<newline />
<newline />
<newline />
<field name="skillid" colspan="4" nolabel="1"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="test_base_tree">
<field name="name">test.base.tree</field>
<field name="model">test.base</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Test Base">
<field name="name"/>
<field name="email"/>
<field name="code"/>
<field name="sal"/>
<field name="ded"/>
<field name="rate"/>
</tree>
</field>
</record>
for your selection field you have to write like this:
you have missed string in selection fields
rate':fields.selection([(10,'10'),
(20,'20'),
(30,'30')],'Rate'),
hope this help
In OpenERP version 6, in my custom module, I changed the Timesheet form view by inheriting as my custom view below:
<record id="oit_hr_timesheet_sheet_form" model="ir.ui.view">
<field name="name">oit.hr.timesheet.sheet.form</field>
<field name="model">hr_timesheet_sheet.sheet</field>
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form" />
<field name="type">form</field>
<field name="arch" type="xml">
<data>
<button name="sign_in" position="replace"/>
<button name="sign_out" position="replace"/>
<field name="state_attendance" position="after">
<field name="day_attendance"/>
</field>
<field name="total_attendance_day" position="replace"/>
<field name="total_difference_day" position="replace"/>
<field name="total_timesheet_day" position="replace"/>
<field name="timesheet_ids" position="after">
<field name="day_difference"/>
<field name="day_timesheet"/>
</field>
<page string="By Day" position="replace" />
<notebook position="inside">
<page string="Time balance">
<group colspan="4" col="2" width="600">
<field name="time_account_balance"/>
<field name="working_hour"/>
<field name="attendance_hour"/>
<separator string="Timesheet numbers until the viewed working period." colspan="4" />
<field name="total_time_account_balance"/>
<field name="total_working_hour"/>
<field name="total_attendance_hour"/>
</group>
</page>
</notebook>
</data>
</field>
</record>
Then the Human Resources / Time Tracking / My Timesheet form totaly crash. But when I go to Administration / Customization / User Interface / Menu Items, and I choose "My Timesheet" menu item to fix its action from "ir.actions.server" to "ir.actions.act_window" and select object "hr_timesheet_sheet.sheet", then choose my view "oit.hr.timesheet.sheet.form" for object's form view, choose my view "oit.hr.timesheet.sheet.tree.simplified" for object's tree view.
Then I have "My Timesheet" form shown correctly.
Why is that? I think there is somethings in my view code not work with "My Timesheet" menu and "ir.actions.server" defined in file hr_timesheet_sheet/hr_timesheet_sheet_data.xml, Here I paste the openerp6 code in hr_timesheet_sheet_data.xml:
<record id="ir_actions_server_timsheet_sheet" model="ir.actions.server">
<field eval="5" name="sequence"/>
<field eval=""""code"""" name="state"/>
<field eval=""""ir.actions.server"""" name="type"/>
<field name="model_id" ref="model_hr_timesheet_current_open"/>
<field eval="[(6,0,[])]" name="child_ids"/>
<field eval=""""action = self.pool.get('hr.timesheet.current.open').open_timesheet(cr, uid, object.id, context)"""" name="code"/>
<field eval=""""True"""" name="condition"/>
<field eval=""""My Timesheet"""" name="name"/>
</record>
<record id="menu_act_hr_timesheet_sheet_form_my_current" model="ir.ui.menu">
<field name="name">My Timesheet</field>
<field eval="1" name="sequence"/>
<field name="parent_id" ref="hr_attendance.menu_hr_time_tracking"/>
<field name="icon">STOCK_JUSTIFY_FILL</field>
<field name="action" ref="ir_actions_server_timsheet_sheet"/>
</record>
Kindly please help me to have correct view code or a solution so that I will not need to change information for menu "My Timesheet" after I upgrade my custom module! thanks a lot!