Add Customer Payment tree in Cash Register In Openerp - openerp-7

How to add customer payment tree to cahs register of openerp.I add in my coding like that.
'customer_payment_lines':fields.one2many('account.voucher','account_id','Customer Payments'),
in account.bank.statement.
But I can't see any line of customer payment in cash register.
What should i do?
Somebody help me.
Thanks in Advance.

For one2many, It is neccesary to put many2one in other object. in your case, you have to put many2one in account.voucher. and also check that you have kept your field "customer_payment_lines" in view. Try this,
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- product tree -->
<record id="view_royalfood_customer_payment" model="ir.ui.view">
<field name="name">Royal Food Customer Payment</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form2" />
<field name="arch" type="xml">
<field name="opening_details_ids" position="after">
<field name="customer_payment_lines">
<tree>
<field name="name"/>
<field name="company_id"/>
<field name="account_id"/>
</tree>
</field>
</field>
</field>
</record>
</data>
</openerp>
Hope this will solve your problem.

Related

Odoo 15 Helpdesk formatting ID field

I need help with the modul Helpdesk. I wanted to add the field ID into the tree view via Addon. I could manage to do so, but now I want to format the field like this Ticket ID : #1234, at the moment its in this kind of format : Ticket ID 1,234. I also canĀ“t find the field ID in the source code.
This my code for the tree view:
<!-- Helpdesk Addon Tree View -->
<record id="helpdesk_addon_tree_view" model="ir.ui.view">
<field name="name">view.helpdesk.addon.tree</field>
<field name="model">helpdesk.ticket</field>
<field name="inherit_id" ref="helpdesk.helpdesk_tickets_view_tree"/>
<field name="arch" type="xml">
<field name="display_name" position="before">
<field name="id" string="ID"/>
</field>
<field name="stage_id" position="after">
<field name="create_date"/>
</field>
</field>
</record>
</odoo>
The id is a number and you can't format it, as a workaround you can add new Char field and override create method to fill it then you can use the new created field in the list view.
from odoo import models, api, fields, _
class HelpdeskTicket(models.Model):
_inherit = 'helpdesk.ticket'
ticket_no = fields.Char(string="Ticket No")
#api.model_create_multi
def create(self, list_value):
tickets = super(HelpdeskTicket, self).create(list_value)
# set ticket Id
for ticket in tickets:
if ticket.id:
ticket.ticket_no= '#' + str(ticket.id)
return tickets
XML will be:
<!-- Helpdesk Addon Tree View -->
<record id="helpdesk_addon_tree_view" model="ir.ui.view">
<field name="name">view.helpdesk.addon.tree</field>
<field name="model">helpdesk.ticket</field>
<field name="inherit_id" ref="helpdesk.helpdesk_tickets_view_tree"/>
<field name="arch" type="xml">
<field name="display_name" position="before">
<field name="ticket_no" string="ID"/>
</field>
<field name="stage_id" position="after">
<field name="create_date"/>
</field>
</field>
</record>
</odoo>

Field does not exist ODOO

I am using Odoo 11 and get the below error when installing a custom module. This is a module that is working in Odoo 10. I cant figure out where I am going wrong.
Field `custom_discount_product_id2` does not exist
Error context:
View `pos.config.custom.discount.form.view`
[view_id: 1029, xml_id: pos_custom.view_pos_config_form_custom_discount, model: pos.config, parent_id: 730]
None" while parsing /odoo/custom/addons/pos_custom/views/pos_custom_sale_view.xml:22, near
<record model="ir.ui.view" id="view_pos_config_form_custom_discount">
<field name="name">pos.config.custom.discount.form.view</field>
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.pos_config_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[#id='title']" position="after">
<group string="Custom Discount">
<field name="custom_discount_product_id2"/>
</group>
</xpath>
</field>
</record>
Here is my sale.py file
from odoo import api, fields, models
class PosConfig(models.Model):
_inherit = 'pos.config'
custom_discount_product_id2 = fields.Many2one('product.product', string='Custom Discount Product')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
And here is the view file.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_pos_config_form_custom_discount">
<field name="name">pos.config.custom.discount.form.view</field>
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.pos_config_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[#id='title']" position="after">
<group string="Custom Discount">
<field name="custom_discount_product_id2" />
</group>
</xpath>
</field>
</record>
</data>
</openerp>
I've checked other modules, restarted server, but for some reason the field is not created.
Make sure <your_module>/__init__.py contains:
from . import models
and that <your_module>/models/__init__.py contains:
from . import sale

How to hide discount field in Invoice form? Odoo

I have try to hide discount field in invoice form by xpath. However it doesn't work.
The following is my code :
<odoo>
<data>
<record model="ir.ui.view" id="hidden_discount">
<field name="name">account.invoice.hidden.discount</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='discount']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
</field>
</record>
</data>
</odoo>
Do you have any solution or suggestion?
There is no direct form view design for One2many field. So we need to upgrade account.invoice.line form view directly.
Try with following code.
<record model="ir.ui.view" id="hidden_discount">
<field name="name">account.invoice.line.hidden.discount</field>
<field name="model">account.invoice.line</field>
<field name="inherit_id" ref="account.view_invoice_line_form"/>
<field name="arch" type="xml">
<field name="discount" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>

In odoo 10 how can we add new fields to right side by inherting,right side does not have any fileds

I want to add to the right side of product in view
views/stock.xml:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_production_lot_form_inherit" model="ir.ui.view">
<field name="model">stock.production.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_form"/>
<field name="arch" type="xml">
<group name="main_group" position="inside">
<group>
<!-- Add your fields here. -->
</group>
</group>
</field>
</record>
</odoo>
Note: You need to add the stock module the your custom module dependencies
and include the views/stock.xml file in your custom module manifest's data files
list.

Openerp 6.1 put product category in sale order line

I want to show the product category in the sale.order.line.tree view of a sales order with the following code which I wrote. It shows the category button under the group by button but on clicking it, I get the following error and I have don't know how to solve the bug:assert groupby_def and groupby_def._classic_write, "Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True"
AssertionError: Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True
Here is my code:
from osv import fields, osv<code>
class sales_order_line_category(osv.osv):
_name='sale.order.line'
_inherit='sale.order.line'
_columns={'categ_id': fields.related('product_id', 'categ_id', type='many2one', relation='product.categ_id'),
}
sales_order_line_category()
My view:
`<?xml version="1.0" encoding="utf-8"?>
<record id="view_sale_orderlinecategory" model="ir.ui.view">
<field name="name">sale.order.line.categoryinherit</field>
<field name="model">sale.order.line</field>
<field name="type">tree</field>
<field name="inherit_id" ref="sale.view_order_line_tree"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="categ_id" string="Category"/>
</field>
</field>
</record>
<record id="view_sale_orderlinecategory2" model="ir.ui.view">
<field name="name">sale.order.line.categoryinherit2</field>
<field name="model">sale.order.line</field>
<field name="type">search</field>
<field name="inherit_id" ref="sale.view_sales_order_uninvoiced_line_filter"/>
<field name="arch" type="xml">
<group expand="0" string="Group By..." >
<filter string="Category of Product" icon="terp-stock_symbol-selection" name="Category" context="{'group_by':'categ_id'}"/>
</group>
</field>
</record>
<record id="view_sale_orderlinecategory3" model="ir.ui.view">
<field name="name">sale.order.line.categoryinherit3</field>
<field name="model">sale.order,line</field>
<field name="type">search</field>
<field name="inherit_id" ref="sale.view_sales_order_uninvoiced_line_filter"/>
<field name="arch" type="xml">
<field name="name" position="before">
<field name="categ_id" string="Category"/>
</field>
</field>
</record>
</data>
`
WOuld you please try with following code replace?
'categ_id': fields.related('product_id', 'categ_id', type='many2one', relation='product.category', store=True),
Check that your field categ_id must be appear in tree view of sale.order.line where you try to do group by categ_id
Hope this help