Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
9877 Widoki

Hello, 

I would like to solve following problem:

I have 2 warehouses(WH1 and WH2) and to 2 receipts operations in inventory (Mycompany : Receipts WH1 and MyCompnay: receipts WH2).

When Procurement team generates new PO, I would like to have an option which warehouse should receive it. 

I found the dropship option which doesn't solve the problem completely since we have to choose from the all contacts.

Instead I want to have a address of chosen warehouse under the shipping address on the PO.


Can you please give me any hint how to solve it?

My gut tells I have to look around "default_location_dest_id"  variable.


Thanks in advance

BR/

N


------------------------------------------------------

Update:

To sort out my problem, based on the hint given by @Waleed Mohsen, I modified report_purchaseorder_document following way

#This part was here
<t t-if="o.dest_address_id">
<t t-set="information_block">
<strong>Shipping address:</strong>
<div t-if="o.dest_address_id">
<div t-field="o.dest_address_id" t-options="{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}" name="purchase_shipping_address"/>
</div>
</t>
</t>

#I added else so then it is not customer address then use the warehouse address:

<t t-else="">
<t t-set="information_block">
<strong>Shipping address:</strong>
<div t-field="o.picking_type_id.warehouse_id.partner_id" t-options="{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}"/>
</t>
</t>



Awatar
Odrzuć
Najlepsza odpowiedź

It's available out of box if you enabled multi warehouses and multi locations.

You already create 2 receipts operations in inventory (Mycompany : Receipts WH1 and MyCompnay: receipts WH2). 

In Mycompany : Receipts WH1  you will set the Default Destination Location to your warehouse e.g WH1/stock.

In Mycompany : Receipts WH2  you will set the Default Destination Location to your warehouse e.g WH2/stock.

Then in ​Requests for Quotation, Deliveries and invoices tab, you will be able to select the operation from Delivery to fields as you can see from the below screenshot:

Delivery To

Update Answer:

By the way shipping address used only for customers.

In Odoo 12, as per help on the field it will only used for drop ship (when you want the vendor to ship to customer) and you said it will not work with you. If you want to purchase for your company so your company address in showing in PO but not as shipping address.

dest_address_id = fields.Many2one('res.partner', string='Drop Ship Address', states=READONLY_STATES,

help="Put an address if you want to deliver directly from the vendor to the customer. "

"Otherwise, keep empty to deliver to your own company.")

Other solution: since you are already configured two receipt operations and already determine the default destination location for each operation and you want to show it in the printed PO, so you can show the Default Destination Location in the report, you have to inherit the purchase order report and show field :

o.picking_type_id.default_location_dest_id.display_name

From this o.picking_type_id.default_location_dest_id you can access all location fields and from it you can get Partner field/whse fields.

This field default_location_dest_id is from stock.location so you can enable developer mode -> settings -> technical -> Database structure -> models and search for stock.location and you will get all fields.

For example, if set the owner in you location so you can get it using partner_id fields and from it you can get the address

o.picking_type_id.default_location_dest_id.partner_id


Hope this will help you.

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Hi Waleed, 

Thank you for your reply. 

The problem is that actual shipping address is not showing purchase order when I print it.

From the report view there is this code:

<t t-if="o.dest_address_id">
<t t-set="information_block">
<strong>Shipping address:</strong>
<div t-if="o.dest_address_id">
<div t-field="o.dest_address_id" t-options="{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}" name="purchase_shipping_address"/>
</div> </t>
</t>

where dest_address_id is false, if I want goods to be delivered in one of my warehouse.

I dig and found following in the "Fields view get": 

<field name="dest_address_id" attrs="{'invisible': [('default_location_dest_id_usage', '!=', 'customer')], 'required': [('default_location_dest_id_usage', '=', 'customer')]}" can_create="true" can_write="true" modifiers="{'invisible':[['default_location_dest_id_usage','!=','customer']],'readonly':[['state','in',['purchase','done','cancel']]],'required':[['default_location_dest_id_usage','=','customer']]}"/>

seems either where should be way to customize it from admin, or I have modify this piece of code. but not sure how i can do it.

p.s. I am sorry I am kind of new here :)


thanks,

N


Awatar
Odrzuć

You can setup shipping address from vendor screen, open vendor screen and from Contact and Addresses tab press on create button and select shipping address and all data and save it, then when you create a PO and select this vendor the shipping address will be shown on the printed PO as below:

https://i.ibb.co/L1CG7B2/Image-4.png

Autor

Thanks a lot but it didn't work for me. no idea why.

I setup shipping address in my company contacts and I setup shipping address for the vendor.

When I print PO it shows nothing.

What the version you are using? from my side I'm using v 11 and I created a new DB and installed purchase app and created a new purchase order and I can see the shipping address for my company without adding any shipping addresses.

Autor

I am using V12.

searched everything through the internet found nothing...

By the way shipping address used only for customers.

In Odoo 12, as per help on the field it will only used for drop ship (when you want the vendor to ship to customer) and you said it will not work with you. If you want to purchase for your company so your company address in showing in PO but not as shipping address.

dest_address_id = fields.Many2one('res.partner', string='Drop Ship Address', states=READONLY_STATES,

help="Put an address if you want to deliver directly from the vendor to the customer. "

"Otherwise, keep empty to deliver to your own company.")

Other solution: since you are already configured two receipt operations and already determine the default destination location for each operation and you want to show it in the printed PO, so you can show the Default Destination Location in the report, you have to inherit the purchase order report and show field :

o.picking_type_id.default_location_dest_id.display_name

Autor

Thanks Mate, this was really helpful. I am almost there :)

Now it shows the name of the stock and I am trying to print physical address of that stock.

any hint where i can find all options available for default_location_dest_id?

thanks a lot

From this o.picking_type_id.default_location_dest_id you can access all location fields and from it you can get Partner field/whse fields.

This field default_location_dest_id is from stock.location so you can enable developer mode -> settings -> technical -> Database structure -> models and search for stock.location and you will get all fields.

For example, if set the owner in you location so you can get it using partner_id fields and from it you can get the address

o.picking_type_id.default_location_dest_id.partner_id

Autor

Thanks mate, i just sorted it out

if someone interested this was what I have looking for:

o.picking_type_id.warehouse_id.partner_id

I will mark your previous reply as an answer for me!

Thanks

You are welcome. I have updated the answer, so if anyone looking for same he will get it easily.

Powiązane posty Odpowiedzi Widoki Czynność
1
sie 17
7779
5
kwi 24
19828
3
kwi 15
7664
1
sie 25
382
1
lip 25
1154