Load bancopal price list in sale.

This commit refs #6142
This commit is contained in:
Sergio Morillo 2018-11-01 23:55:37 +01:00
parent e6bba2fd16
commit db42d0503e
3 changed files with 27 additions and 1 deletions

View File

@ -3,6 +3,7 @@
from trytond.pool import Pool
from . import party
from . import stock
from . import sale
def register():
@ -10,4 +11,5 @@ def register():
party.Party,
party.BancopalPriceList,
stock.Move,
sale.Sale,
module='sale_bancopal', type_='model')

16
sale.py Normal file
View File

@ -0,0 +1,16 @@
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.pool import PoolMeta
__all__ = ['Sale']
class Sale:
__name__ = 'sale.sale'
__metaclass__ = PoolMeta
def on_change_party(self):
super(Sale, self).on_change_party()
if self.party and self.party.bancopal and \
self.party.bancopal_price_list:
self.price_list = self.party.bancopal_price_list

View File

@ -110,4 +110,12 @@ Discount applied when quantity is 10::
>>> move.quantity = 10
>>> move.unit_price
Decimal('5.0000')
Decimal('5.0000')
Create a sale::
>>> Sale = Model.get('sale.sale')
>>> sale = Sale()
>>> sale.party = customer
>>> sale.price_list == price_list
True