diff --git a/__init__.py b/__init__.py
index 2d71d9861f..c729ff4ba7 100644
--- a/__init__.py
+++ b/__init__.py
@@ -13,6 +13,7 @@ def register():
Category,
Template,
Configuration,
+ AccountMove,
UpdateCostPriceAsk,
UpdateCostPriceShowMove,
module='account_stock_continental', type_='model')
diff --git a/account.py b/account.py
index 4292981247..eeef5b1b4c 100644
--- a/account.py
+++ b/account.py
@@ -4,7 +4,7 @@ from trytond.model import fields
from trytond.pyson import Eval, Bool, Get
from trytond.pool import PoolMeta
-__all__ = ['Configuration']
+__all__ = ['Configuration', 'AccountMove']
__metaclass__ = PoolMeta
@@ -19,3 +19,12 @@ class Configuration:
'account.account', 'Cost Price Counterpart Account', domain=[
('company', 'in', [Get(Eval('context', {}), 'company'), None]),
]))
+
+
+class AccountMove:
+ __name__ = 'account.move'
+
+ @classmethod
+ def _get_origin(cls):
+ return super(AccountMove, cls)._get_origin() + ['stock.move',
+ 'product.product']
diff --git a/account.xml b/account.xml
index 1482cee775..3fef7181f1 100644
--- a/account.xml
+++ b/account.xml
@@ -73,5 +73,15 @@ this repository contains the full copyright notices and license terms. -->
stock
+
+
+
+
+
+
+
+
+
+
diff --git a/product.py b/product.py
index 2b7939f51a..63ffbc634f 100644
--- a/product.py
+++ b/product.py
@@ -173,7 +173,7 @@ class UpdateCostPriceShowMove(ModelView):
('id', '!=', Eval('stock_account')),
],
depends=['company', 'stock_account'], required=True)
- description = fields.Char('Description', required=True)
+ description = fields.Char('Description')
class UpdateCostPrice(Wizard):
@@ -260,13 +260,11 @@ class UpdateCostPrice(Wizard):
Line = Pool.get('account.move.line')
amount = self.show_move.amount
return [Line(
- name=self.ask_price.product.name,
debit=amount if amount > 0 else 0,
credit=-amount if amount < 0 else 0,
account=self.show_move.stock_account,
),
Line(
- name=self.ask_price.product.name,
debit=-amount if amount < 0 else 0,
credit=amount if amount > 0 else 0,
account=self.show_move.counterpart,
@@ -284,10 +282,11 @@ class UpdateCostPrice(Wizard):
period_id = Period.find(user.company.id)
with Transaction().set_user(0, set_context=True):
return Move(
- name=self.show_move.description,
+ description=self.show_move.description,
period=period_id,
journal=self.show_move.journal,
date=Date.today(),
+ origin=self.ask_price.product,
lines=self.get_move_lines(),
)
diff --git a/stock.py b/stock.py
index f76e886c8e..9b83b7d98d 100644
--- a/stock.py
+++ b/stock.py
@@ -26,7 +26,7 @@ class Move:
'wrong type'
with Transaction().set_user(0, set_context=True):
- move_line = AccountMoveLine(name=self.rec_name)
+ move_line = AccountMoveLine()
if (type_.endswith('supplier')
and self.product.cost_price_method != 'fixed'):
unit_price = self.unit_price
@@ -58,7 +58,6 @@ class Move:
AccountMoveLine = pool.get('account.move.line')
with Transaction().set_user(0, set_context=True):
move_line = AccountMoveLine(
- name=self.rec_name,
account=self.product.account_stock_used,
)
if not amount:
@@ -89,6 +88,7 @@ class Move:
journal=account_configuration.stock_journal,
period=period_id,
date=date,
+ origin=self,
lines=move_lines,
)