Vauxoo / addons-vauxoo

All our modules related to developments that solves generic issues on Odoo, or that solve internal problems on Odoo Core, if something is here, maybe it is solving an issue in your company, try it and report what you see.
http://www.vauxoo.com
193 stars 288 forks source link

[ADD] stock_custom_exchange_rate_date: Module to set custom rate date #1418

Closed luisg123v closed 4 years ago

luisg123v commented 4 years ago

This module allows to set a customized date on transfers to be used when computing product unit prices, instead of the date when the transfer is validated, in case exchange rates are involved.

The use for the above is that created journal entries take the newly computed unit price, which makes the inventory to be valuated using the specified rate.

luisg123v commented 4 years ago

@nhomar,

Could you review this, please?

CC @rsilvam21 @hugho-ad

luisg123v commented 4 years ago

FYI @dsabrinarg,

This is the module for the DTT's requirement regarding date rate on transfers.

JulioSerna commented 4 years ago

@luisg123v

I think this field could be omitted by the user that make the reception and I think this field should be required when the partner o purchase related it is in secondary currency

what do you think @nhomar ?

nhomar commented 4 years ago

I think this field could be omitted by the user that make the reception and I think this field should be required when the partner o purchase related it is in secondary currency

@JulioSerna I think it is ok like this with good dcumentation, Maybe we must to look for an automatic filling following some criteria and more smarter wizard to ask explicitaly for this.

For now it is ok the required but I think it will bring functional problems (@luisg123v please execute a required with this criteria if possible).

luisg123v commented 4 years ago

For now it is ok the required but I think it will bring functional problems (@luisg123v please execute a required with this criteria if possible).

AFAIK, this is not possible without introducing several new fields, because we would need to compare the company's currency against the linked purchase order's currency, neither of which are available on the picking natively.

nhomar commented 4 years ago

@hbto Your accounting eagle eye is required here please before merge.

hbto commented 4 years ago

As a MVP is ok for me,

But we have to take into account the suggestions made by @JulioSerna

The if statemente at stock.move says: I will skip the new computation unless a exchange_rate_date is not set.

Next version should care about that.

Regards.

luisg123v commented 4 years ago

@hbto,

The if statement also skips the new behavior if the picking doesn't come from a purchase order.

luisg123v commented 4 years ago

@hbto,

I managed to hide the new field when the picking doesn't come from a purchase order, thanks to the field purchase_id available on the picking.

FYI I also included tests

dsabrinarg commented 4 years ago

Successful functional tests 👍

rsilvam21 commented 4 years ago

+1

I tested in this dummy:

Dummy B&F: https://git.vauxoo.com/benandfrank/benandfrank/-/merge_requests/990

@nhomar @moylop260

Could you merge this, please

luisg123v commented 4 years ago

This has been approved by @nhomar, @hbto, @JulioSerna and @dsabrinarg, so I'll merge.