Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] refactored for correct use with variants and store revaluation …
…in move
- Loading branch information
1 parent
21854ac
commit d0ae8ce
Showing
13 changed files
with
298 additions
and
152 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,7 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016 Eficent Business and IT Consulting Services S.L. | ||
# (http://www.eficent.com) | ||
# © 2016 Serpent Consulting Services Pvt. Ltd. | ||
# Copyright 2016 Serpent Consulting Services Pvt. Ltd. | ||
# (<http://www.serpentcs.com>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from . import models | ||
from . import wizards |
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
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,8 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016 Eficent Business and IT Consulting Services S.L. | ||
# (http://www.eficent.com) | ||
# © 2016 Serpent Consulting Services Pvt. Ltd. | ||
# Copyright 2016 Serpent Consulting Services Pvt. Ltd. | ||
# (<http://www.serpentcs.com>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import product | ||
from . import account_move | ||
from . import stock_inventory_revaluation |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016 Eficent Business and IT Consulting Services S.L. | ||
# (http://www.eficent.com) | ||
# Copyright 2016 Serpent Consulting Services Pvt. Ltd. | ||
# (<http://www.serpentcs.com>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from openerp import api, exceptions, fields, models, _ | ||
|
||
|
||
class AccountMove(models.Model): | ||
|
||
_inherit = 'account.move' | ||
|
||
stock_inventory_revaluation_id = fields.Many2one( | ||
comodel_name='stock.inventory.revaluation', | ||
string='Stock Inventory Revaluation', | ||
ondelete='restrict', copy=False) | ||
|
||
@api.multi | ||
def unlink(self): | ||
for rec in self: | ||
if rec.stock_inventory_revaluation_id: | ||
raise exceptions.Warning( | ||
_("You cannot remove the journal item that is related " | ||
"to an inventory revaluation")) | ||
return super(AccountMove, self).unlink() | ||
|
||
|
||
class AccountMoveLine(models.Model): | ||
|
||
_inherit = 'account.move.line' | ||
|
||
stock_inventory_revaluation_id = fields.Many2one( | ||
comodel_name='stock.inventory.revaluation', | ||
related='move_id.stock_inventory_revaluation_id', | ||
string='Stock Inventory Revaluation', | ||
store=True, ondelete='restrict', copy=False) | ||
|
||
@api.multi | ||
def unlink(self): | ||
for rec in self: | ||
if rec.stock_inventory_revaluation_id: | ||
raise exceptions.Warning( | ||
_("You cannot remove the journal item that is related " | ||
"to an inventory revaluation")) | ||
return super(AccountMoveLine, self).unlink() |
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
Oops, something went wrong.