-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from sodexis/9.0-partner-address-type-default
[PORT][9.0] partner address type default
- Loading branch information
Showing
7 changed files
with
38 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# For copyright and license notices, see __openerp__.py file in root directory | ||
############################################################################## | ||
# © 2015 AvanzOSC, Pedro M. Baeza, Sodexis, OdooMRP team | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# For copyright and license notices, see __openerp__.py file in root directory | ||
############################################################################## | ||
from . import res_partner | ||
from . import sale_order | ||
# © 2015 AvanzOSC, Pedro M. Baeza, Sodexis, OdooMRP team | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import res_partner, sale_order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# For copyright and license notices, see __openerp__.py file in root directory | ||
############################################################################## | ||
from openerp import models | ||
# © 2015 AvanzOSC, Pedro M. Baeza, Sodexis, OdooMRP team | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from openerp import models, api | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = "sale.order" | ||
|
||
def onchange_partner_id(self, cr, uid, ids, part, context=None): | ||
partner_obj = self.pool['res.partner'] | ||
result = super(SaleOrder, self).onchange_partner_id( | ||
cr, uid, ids, part, context=context) | ||
partner = partner_obj.browse(cr, uid, part, context=context) | ||
value = result['value'] | ||
if partner.child_ids: | ||
for line in partner.child_ids: | ||
if line.type == 'invoice' and line.default_address: | ||
value['partner_invoice_id'] = line.id | ||
if line.type == 'delivery' and line.default_address: | ||
value['partner_shipping_id'] = line.id | ||
result['value'] = value | ||
@api.onchange('partner_id') | ||
def onchange_partner_id(self): | ||
result = super(SaleOrder, self).onchange_partner_id() | ||
for line in self.partner_id.child_ids: | ||
if line.type == 'invoice' and line.default_address: | ||
self.partner_invoice_id = line.id | ||
if line.type == 'delivery' and line.default_address: | ||
self.partner_shipping_id = line.id | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters