wip no funciona el onchange en el web client en campos one2many
Si ponemos location_dst_id en el create, los stock moves se crean con el location antiguo (partner_vendors) https://github.com/odoo/odoo/issues/2693
This commit is contained in:
parent
a9f5587af5
commit
beaee63e89
1 changed files with 11 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2021 Criptomart
|
||||
# Copyright 2021-2024 Criptomart
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||
|
||||
import logging
|
||||
|
@ -27,6 +27,15 @@ class Picking(models.Model):
|
|||
pick.change_dest_location()
|
||||
return pick
|
||||
|
||||
@api.onchange("partner_id")
|
||||
def onchange_partner_id(self):
|
||||
if self.partner_id and self.picking_type_id.is_deposit:
|
||||
if self.picking_type_id.code == 'internal':
|
||||
self.location_dest_id = self.partner_id.deposit_sale_location_id
|
||||
elif self.picking_type_id.code == 'incoming':
|
||||
self.location_dest_id = self.partner_id.deposit_buy_location_id
|
||||
_logger.warning("location id: %s %s", self.location_dest_id, self.partner_id.deposit_sale_location_id)
|
||||
|
||||
def change_dest_location(self):
|
||||
if self.picking_type_id.code == 'internal':
|
||||
if not self.partner_id.deposit_sale_accept:
|
||||
|
|
Loading…
Add table
Reference in a new issue