Skip to content

Commit

Permalink
modificari preluate din 16
Browse files Browse the repository at this point in the history
  • Loading branch information
dhongu committed Jul 8, 2024
1 parent 4f33f84 commit 54db0eb
Show file tree
Hide file tree
Showing 8 changed files with 618 additions and 0 deletions.
78 changes: 78 additions & 0 deletions l10n_ro_stock_account_store/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
================================
Romania - Stock Accounting Store
================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-dhongu%2Fl10n--romania-lightgray.png?logo=github
:target: https://github.com/dhongu/l10n-romania/tree/13.0/l10n_ro_stock_account_store
:alt: dhongu/l10n-romania

|badge1| |badge2| |badge3|

Stock accounting for receptions, deliveries from store

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/dhongu/l10n-romania/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/dhongu/l10n-romania/issues/new?body=module:%20l10n_ro_stock_account_store%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* NextERP Romania
* Dorin Hongu
* Forest and Biomass Romania

Contributors
~~~~~~~~~~~~

* `NextERP Romania <https://www.nexterp.ro>`_:

* Fekete Mihai <[email protected]>
* Alexandru Teodor <[email protected]>

* `Terrabit <https://www.terrabit.ro>`_:

* Dorin Hongu <[email protected]>



Do not contact contributors directly about support or help with technical issues.

Maintainers
~~~~~~~~~~~

.. |maintainer-dhongu| image:: https://github.com/dhongu.png?size=40px
:target: https://github.com/dhongu
:alt: dhongu

Current maintainer:

|maintainer-dhongu|

This module is part of the `dhongu/l10n-romania <https://github.com/dhongu/l10n-romania/tree/13.0/l10n_ro_stock_account_store>`_ project on GitHub.

You are welcome to contribute.
4 changes: 4 additions & 0 deletions l10n_ro_stock_account_store/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details

from . import models
15 changes: 15 additions & 0 deletions l10n_ro_stock_account_store/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# © 2024 Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details
{
"name": "Romania - Stock Accounting Store",
"version": "15.0.1.0.0",
"category": "Localization",
"summary": "Romania - stock account",
"author": "Dorin Hongu," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-romania",
"depends": ["l10n_ro_stock_account"],
"license": "AGPL-3",
"data": [],
"installable": True,
"maintainers": ["dhongu"],
}
4 changes: 4 additions & 0 deletions l10n_ro_stock_account_store/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details

from . import stock_move
81 changes: 81 additions & 0 deletions l10n_ro_stock_account_store/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# © 2024 Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details


import logging

from odoo import api, models

_logger = logging.getLogger(__name__)

class StockMove(models.Model):
_name = "stock.move"
_inherit = ["stock.move", "l10n.ro.mixin"]

@api.model
def _get_valued_types(self):
valued_types = super(StockMove, self)._get_valued_types()
if not self.filtered("is_l10n_ro_record"):
return valued_types

valued_types += [
'in_store' # 'Intrare in magazin'
'out_store' # 'Iesire din maazin
]
return valued_types


def _is_in_store(self):
"""Este receptie in magazin"""
it_is = self._is_in() and self.location_dest_id.l10n_ro_merchandise_type == 'store'
return it_is

def _create_in_store_svl(self, forced_quantity=None):
move = self.with_context(standard=True, valued_type="in_store")
# inregistrarea adaosului comecial
# 371 = %
# 378
# 4428
account_diff = self.company_id.l10n_ro_property_stock_picking_payable_account_id

svls = self.env['stock.valuation.layer']
# move._create_account_move_line(
# acc_dest,
# acc_valuation,
# journal_id,
# qty,
# description,
# svl_id,
# qty * sale_price,
# )
svl_vals_list = []
for move_line in move.move_line_ids:
if move_line.qty_done == 0:
continue
svl_vals = {}
svl_vals.update(move._prepare_common_svl_vals())
svl_vals_list.append(svl_vals)
return self.env['stock.valuation.layer'].sudo().create(svl_vals_list)


def _is_out_store(self):
"""Este iesire din magazin"""
it_is = self._is_out() and self.location_id.l10n_ro_merchandise_type == 'store'
return it_is

def _create_out_store_svl(self, forced_quantity=None):
# % = 371
# 607
# 378
# 4428

move = self.with_context(standard=True, valued_type="out_store")
svl_vals_list = []
for move_line in move.move_line_ids:
if move_line.qty_done == 0:
continue
svl_vals = {}
svl_vals.update(move._prepare_common_svl_vals())
svl_vals_list.append(svl_vals)
return self.env['stock.valuation.layer'].sudo().create(svl_vals_list)

8 changes: 8 additions & 0 deletions l10n_ro_stock_account_store/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

* `Terrabit <https://www.terrabit.ro>`_:

* Dorin Hongu <[email protected]>



Do not contact contributors directly about support or help with technical issues.
1 change: 1 addition & 0 deletions l10n_ro_stock_account_store/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stock accounting for receptions, deliveries from store
Loading

0 comments on commit 54db0eb

Please sign in to comment.