Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
8e399715
Commit
8e399715
authored
10 years ago
by
Josse Colpaert
Browse files
Options
Downloads
Patches
Plain Diff
[IMP] Do the landed costs out of the quants already out of stock
parent
57ad514b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
addons/stock_landed_costs/stock_landed_costs.py
+30
-2
30 additions, 2 deletions
addons/stock_landed_costs/stock_landed_costs.py
with
30 additions
and
2 deletions
addons/stock_landed_costs/stock_landed_costs.py
+
30
−
2
View file @
8e399715
...
...
@@ -106,11 +106,12 @@ class stock_landed_cost(osv.osv):
accounts
=
product_obj
.
get_product_accounts
(
cr
,
uid
,
line
.
product_id
.
product_tmpl_id
.
id
,
context
=
context
)
debit_account_id
=
accounts
[
'
property_stock_valuation_account_id
'
]
credit_account_id
=
cost_product
.
property_account_expense
and
cost_product
.
property_account_expense
.
id
or
cost_product
.
categ_id
.
property_account_expense_categ
.
id
already_out_account_id
=
cost_product
.
property_account_income
and
cost_product
.
property_account_income
.
id
or
cost_product
.
categ_id
.
property_account_income_categ
.
id
if
not
credit_account_id
:
raise
osv
.
except_osv
(
_
(
'
Error!
'
),
_
(
'
Please configure Stock Expense Account for product: %s.
'
)
%
(
cost_product
.
name
))
return
self
.
_create_account_move_line
(
cr
,
uid
,
line
,
move_id
,
credit_account_id
,
debit_account_id
,
context
=
context
)
return
self
.
_create_account_move_line
(
cr
,
uid
,
line
,
move_id
,
credit_account_id
,
debit_account_id
,
already_out_account_id
,
context
=
context
)
def
_create_account_move_line
(
self
,
cr
,
uid
,
line
,
move_id
,
credit_account_id
,
debit_account_id
,
context
=
None
):
def
_create_account_move_line
(
self
,
cr
,
uid
,
line
,
move_id
,
credit_account_id
,
debit_account_id
,
already_out_account_id
,
context
=
None
):
"""
Generate the account.move.line values to track the landed cost.
"""
...
...
@@ -131,6 +132,33 @@ class stock_landed_cost(osv.osv):
'
credit
'
:
line
.
additional_landed_cost
,
'
account_id
'
:
credit_account_id
},
context
=
context
)
#Check if its quants are still in stock and if not create extra move
move_obj
=
self
.
pool
.
get
(
"
stock.move
"
)
move
=
move_obj
.
browse
(
cr
,
uid
,
move_id
,
context
=
context
)
qty
=
0
for
quant
in
move
.
quant_ids
:
if
quant
.
location_id
.
usage
!=
'
internal
'
:
qty
+=
quant
.
qty
if
qty
>
0
:
aml_obj
.
create
(
cr
,
uid
,
{
'
name
'
:
line
.
name
,
'
move_id
'
:
move_id
,
'
product_id
'
:
line
.
product_id
.
id
,
'
quantity
'
:
qty
,
'
credit
'
:
line
.
additional_landed_cost
*
qty
/
line
.
quantity
,
'
account_id
'
:
debit_account_id
},
context
=
context
)
aml_obj
.
create
(
cr
,
uid
,
{
'
name
'
:
line
.
name
,
'
move_id
'
:
move_id
,
'
product_id
'
:
line
.
product_id
.
id
,
'
quantity
'
:
qty
,
'
debit
'
:
line
.
additional_landed_cost
*
qty
/
line
.
quantity
,
'
account_id
'
:
already_out_account_id
},
context
=
context
)
return
True
def
_create_account_move
(
self
,
cr
,
uid
,
cost
,
context
=
None
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment