Minor Fix field required
This commit is contained in:
parent
f93429db61
commit
9cc5bd5dea
|
@ -0,0 +1,29 @@
|
|||
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/build
|
||||
/dist
|
||||
*egg-info
|
||||
|
||||
|
||||
/node_modules
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
|
||||
.DS_Store
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
package-lock*
|
||||
|
||||
/__pycache__
|
||||
/app/__pycache__
|
||||
/app/commons/__pycache__
|
|
@ -44,7 +44,7 @@ class PurchaseLine(metaclass=PoolMeta):
|
|||
states=STATES)
|
||||
gross_unit_price_wo_round = fields.Numeric('Gross Price without rounding',
|
||||
digits=(16, DIGITS + DISCOUNT_DIGITS), readonly=True)
|
||||
discount = fields.Numeric('Discount', digits=(16, DISCOUNT_DIGITS), states=STATES)
|
||||
discount = fields.Numeric('Discount', digits=(16, DISCOUNT_DIGITS))
|
||||
stock_quantity = fields.Function(fields.Float('Stock Quantity',
|
||||
digits=(16, 2), depends=['product'], states=STATES),
|
||||
'on_change_with_stock_quantity')
|
||||
|
@ -65,6 +65,9 @@ class PurchaseLine(metaclass=PoolMeta):
|
|||
cls.amount.on_change_with.add('gross_unit_price')
|
||||
if 'discount' not in cls.quantity.on_change:
|
||||
cls.quantity.on_change.add('discount')
|
||||
cls._error_messages.update({
|
||||
'purchase_without_warehouse': ('Missing warehouse in purchase'),
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
def default_discount():
|
||||
|
@ -118,6 +121,8 @@ class PurchaseLine(metaclass=PoolMeta):
|
|||
@fields.depends('product', 'purchase')
|
||||
def on_change_with_stock_quantity(self, name=None):
|
||||
res = 0
|
||||
if not self.purchase.warehouse:
|
||||
self.raise_user_error('purchase_without_warehouse')
|
||||
location_id = self.purchase.warehouse.id
|
||||
if self.product:
|
||||
stock_context = {
|
||||
|
|
|
@ -5,6 +5,7 @@ depends:
|
|||
purchase
|
||||
account_invoice_discount
|
||||
purchase_shipment_cost
|
||||
purchase_editable_line
|
||||
xml:
|
||||
product.xml
|
||||
purchase.xml
|
||||
|
|
Loading…
Reference in New Issue