bug padding
This commit is contained in:
@@ -1120,11 +1120,13 @@ class Line(DescriptionOriginMixin, MoveLineMixin, ModelSQL, ModelView):
|
|||||||
|
|
||||||
def get_rate(self,name=None):
|
def get_rate(self,name=None):
|
||||||
amount = self.credit if self.credit else self.debit
|
amount = self.credit if self.credit else self.debit
|
||||||
if self.amount_second_currency and amount:
|
amount_second_currency = getattr(self, 'amount_second_currency', None)
|
||||||
return round(abs(self.amount_second_currency) / amount, 6)
|
if amount_second_currency and amount:
|
||||||
|
return round(abs(amount_second_currency) / amount, 6)
|
||||||
|
|
||||||
def _set_rate_from_amounts(self):
|
def _set_rate_from_amounts(self):
|
||||||
if self.amount_second_currency and not self.rate:
|
if (getattr(self, 'amount_second_currency', None)
|
||||||
|
and not getattr(self, 'rate', None)):
|
||||||
self.rate = self.get_rate()
|
self.rate = self.get_rate()
|
||||||
|
|
||||||
@fields.depends(
|
@fields.depends(
|
||||||
@@ -1597,7 +1599,8 @@ class Line(DescriptionOriginMixin, MoveLineMixin, ModelSQL, ModelView):
|
|||||||
lines = super(Line, cls).create(vlist)
|
lines = super(Line, cls).create(vlist)
|
||||||
to_save = []
|
to_save = []
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.amount_second_currency and not line.rate:
|
if (getattr(line, 'amount_second_currency', None)
|
||||||
|
and not getattr(line, 'rate', None)):
|
||||||
line._set_rate_from_amounts()
|
line._set_rate_from_amounts()
|
||||||
to_save.append(line)
|
to_save.append(line)
|
||||||
if to_save:
|
if to_save:
|
||||||
|
|||||||
@@ -1991,9 +1991,9 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin, InvoiceReportMixin):
|
|||||||
move_line_.account = gl.product.account_stock_in_used
|
move_line_.account = gl.product.account_stock_in_used
|
||||||
|
|
||||||
move_lines = [move_line,move_line_]
|
move_lines = [move_line,move_line_]
|
||||||
if move_line.amount_second_currency:
|
if getattr(move_line, 'amount_second_currency', None):
|
||||||
move_line.rate = move_line.get_rate()
|
move_line.rate = move_line.get_rate()
|
||||||
if move_line_.amount_second_currency:
|
if getattr(move_line_, 'amount_second_currency', None):
|
||||||
move_line_.rate = move_line_.get_rate()
|
move_line_.rate = move_line_.get_rate()
|
||||||
|
|
||||||
if drop:
|
if drop:
|
||||||
@@ -2032,9 +2032,9 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin, InvoiceReportMixin):
|
|||||||
drop_line_.second_currency = self.currency
|
drop_line_.second_currency = self.currency
|
||||||
drop_line_.amount_second_currency = -original_amount
|
drop_line_.amount_second_currency = -original_amount
|
||||||
move_lines = [drop_line,drop_line_]
|
move_lines = [drop_line,drop_line_]
|
||||||
if drop_line.amount_second_currency:
|
if getattr(drop_line, 'amount_second_currency', None):
|
||||||
drop_line.rate = drop_line.get_rate()
|
drop_line.rate = drop_line.get_rate()
|
||||||
if drop_line_.amount_second_currency:
|
if getattr(drop_line_, 'amount_second_currency', None):
|
||||||
drop_line_.rate = drop_line_.get_rate()
|
drop_line_.rate = drop_line_.get_rate()
|
||||||
|
|
||||||
return move_lines
|
return move_lines
|
||||||
|
|||||||
Reference in New Issue
Block a user