How to add new "Unreconciled Entries" filter for "Customer Statement Report" in odoo7 - openerp-7

In Accounting -> Customers -> Customer Statement Report ,
I want to add one more filter "Unreconciled Entries" below the already existing "Unreconciled Entries" filter.And want to add this by inheritance which is having functionality same as available one.
For this I override "set_context"(from third_party_ledger class) method written for "Unreconciled Entries".But it is not working.
Thanks in advance

Related

How to relate fields in Odoo 11 CE

I added a custom field in "account.payment" model, I also added it in "account.move.line" model (aka: Journal Item).
The value of the custom field is entered from account.payment and since the journal items are generated from a payment creation I want to do the following:
If account.move.line.id is created by account.payment.id
let account.move.line.custom_field = account.payment.custom_field
I appreciate your help
You have to find in account.move.line that represent the relation(foreign_key) with account.payment, let says payment_id, this field allows you to access to account.payment model, and for your case you just need to do:
field_in_account_move_line = payment_id.field_in_account_payment
I hope this answer can be helpful for you.

IcCube Reporting : How to stop drill in a hierarchy?

When we query a dimension/hierarchy with multiple levels, the drill is by default allowed thru all the levels of that hierarchy...
For example, in a hierarchy made of : Continent/Country/State/City.
What is the solution to restrict the drill to the State level (i.e. not showing the city level) without having to create a new hierarchy without City ?
I heard that this can be done using fonctions in the schema scripts to "flatten" the hierarchy.
Can someone give me a live example of that ?
The first is mapping our navigation as an MDX function (you could also copy&paste the code but there is no reuse). Somethink like this (Sales example) :
CREATE FUNCTION navigationDemo(_x) AS
{
CASE
WHEN _x.hierarchy is [Customers].[Geography] THEN [Product].[Product].[Category]
WHEN _x.hierarchy is [Product].[Product] THEN [Time].[Year].[Year]
ELSE {}
END
}
Once this is done we can go to our widget, in our example a table, and define a Drilldown Strategy. It should be of type mdxExpression and we can insert into the MDX Expression our newly created function
navigationDemo( $member ) // where $member is the clicked member in the table
Do no forget to set the 'Filter by' as we want the new data to be filtered by the clicked member.

Shall I record the user name who modify a certain field by Odoo?

.py file:
….
namex=fields.Text()
moifier=fields.Many2one(‘res.users’, string=”Modifier”)
…
When some user modify “namex”, his/her name should be recorded on field “modifier” automatically; what code should I make? I try “onchange/depends”, but failed; maybe modifier could be a “text field/ char field”?
in addition, shall I set "access_rule" to set users just see the records created by the members in his/her own group?
Odoo already has that for you. Every model has those fields, which are automatically created and updated each time you create, or write:
create_date (datetime): when record is created
create_uid (many2one): user who created this record
write_date (datetime): last time record is updated
write_uid (many2one): last user updated this record
Go to Settings > Technical > Database Structure > Models for more details.
While Odoo will keep for you a track of the last user which has modified a record, a modifier per field is not kept. I can see the interest of such a functionality in many cases.
To do that for a particular model one possibility is to redefine the write method of this model. In your .py file you may want to add something like this:
#api.model
def write(self):
if self.namex in values:
values.update({'modifier': uid})
super().write(cr, uid, ids, values, context)
Another way to do that in a more flexible way is to use the #onchange decorator:
#onchange('your_sensible_field_name'):
def set_modifier(self):
self.modifer = self.env.user
You may also want to take a look at the #depends decorator.

Limit products to company assigned to user in multi-company Odoo 9

I have a multi-company setup in Odoo, and I would like to limit the products that each user (under the group "User") can access (read/write/create/delete) to the products assigned to the company that the user is assigned to.
To be clear, I have:
Companies:
Company A
Company B
Users:
User A (assigned to "Company A" and user group "User")
User B (assigned to "Company B" and user group "User")
Products:
Product A (assigned to "Company A")
Product B (assigned to "Company B")
With the default setup, User A has access to both Product A and Product B, and I would like user A to have access exclusively to product A, on all modules (Sales, Inventory, POS…)
I believe that is possible to accomplish using Record Rules, but I haven't been able to do it.
I got the answer I needed from Jerome Guerriat at the the Odoo forums. I only needed to tick a checkbox under the general settings page:
There already is a product.product multicompany rule (but it is
inactive by default): "Product multi-company"
xml id: product.product_comp_rule
You can active it by going to settings => general settings. Check
"manage multi company", then uncheck "share product to all companies"
link here: https://www.odoo.com/es_ES/forum/ayuda-1/question/limit-products-to-company-assigned-to-user-in-multi-company-odoo-9-102686
Odoo's record rules are the way to do it, as you mentioned it by yourself. For example look at the rule for sales order (sale.order). It's global (no group selected/assigned) and it's restricted to companies:
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
Now create your own record rules for product.template and product.product like the example under Settings/Technical/Security/Record Rules (in Odoo V9 you'll need developer mode to see this) or within a custom module.
Odoo Can manage share partner and product without add rules:
Use multiple company
Don`t forget add parent company at Settings > Users> companies (choose child company)
Uncheck Share partner to all companies and Share product to all companies at Settings > General Settings > Shared resources
So, Difference company can`t read product.....

Vb.net 2010 Reading sub properties of an object in reportViewer

I am creating some reports using object datasources.
I have the following scenario:
in my software the user can create a list of products specifying a code, the product name, the price and the vat rate (this last two attributes will be used as suggestions when the user will place the product inside an order).
When a user creates an order he can place products within it by specifying for each product the quantity and he can also override the suggested price and the vat rate.
So basically i have two models to represent the products:
ProductModel (used to define product name, product code and the default suggestion for price and vat rate)
OrderProductModel (used to place products within an order, specify the quantity and override the default product suggestion for price and vat number)
ProductModel:
id
code
name
price
vat
OrderProductModel:
id
order (reference to an OrderModel object)
product (reference to a ProductModel to read the code and the name and the suggestions for price and vat rate)
quantity
price
vat
Now what I need to do with my report is to fill a table of OrderProduct objects and show the following informations for each product:
code (orderProduct.product.code)
name (orderProduct.product.name)
price (orderProduct.price)
quantity (orderProduct.quantity)
(suppose orderProduct is an instance of OrderProductModel)
Now the question is "how to define the report rule to access to code and name?"...
I am using visual studio 2010 and by reading here: http://www.gotreportviewer.com/objectdatasources/index.html
they says that the syntax: =Fields!Object.Value.attribute no longer works...
I tought i could solve the problem by adding to the OrderProductModel some properties that will read the properties of the related ProductModel instance.
But i'm sure there are better way that does not break the model...
Just an update to this, its now fixed in SP1. The requirement to get it to work is to make sure ALL classes used in properties of the datasource are serializable.
more info at:
http://wraithnath.blogspot.com/2011/04/reportviewer-object-datasource-nested.html
I found that this is a bug...
if you make all your object serializable this should be fixed in the SP1 ...
read more here: http://blogs.msdn.com/b/brianhartman/archive/2010/10/27/nested-objects-in-local-mode.aspx