Skip to content

Commit

Permalink
Refactor stock valuation layer field and methods.
Browse files Browse the repository at this point in the history
Renamed "reception_store" and "delivery_store" to "in_store" and "out_store" for improved clarity and consistency. Updated related methods and logic to reflect the new terminology throughout the module.
  • Loading branch information
dhongu committed Jan 24, 2025
1 parent d75ce70 commit 081c9d4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion l10n_ro_account_sequence/views/account_payment_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='journal_id']" position="after">
<field name="l10n_ro_cash_document_type" invisible="not l10n_ro_cash_document_type"/>
<field name="l10n_ro_cash_document_type" invisible="not l10n_ro_cash_document_type" />
</xpath>
</field>
</record>
Expand Down
52 changes: 26 additions & 26 deletions l10n_ro_stock_account_store/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,38 @@ def _get_valued_types(self):
return valued_types

valued_types += [
"reception_store",
"delivery_store",
"in_store",
"out_store",
]
return valued_types

def _is_reception_store(self):
it_is = self._is_in() and self.location_dest_id.l10n_ro_merchandise_type == "store"
def _is_in_store(self):
"Este o intrare in magazie?"
it_is = (
self.location_id.l10n_ro_merchandise_type != "store"
and self.location_dest_id.l10n_ro_merchandise_type == "store"
)
return it_is

def _is_delivery_store(self):
it_is = self._is_out() and self.location_id.l10n_ro_merchandise_type == "store"
def _is_out_store(self):
"Este o iesire din magazie?"
it_is = (
self.location_id.l10n_ro_merchandise_type == "store"
and self.location_dest_id.l10n_ro_merchandise_type != "store"
)
return it_is

def _create_reception_store_svl(self, forced_quantity=None):
svl_values = self._get_in_svl_vals(forced_quantity)
def _create_in_store_svl(self, forced_quantity=None):
svl_values = self._get_in_svl_vals(self.quantity)
for svl_value in svl_values:
svl_value.update(
{
"l10n_ro_valued_type": "reception_store",
}
)
svl_value.update({"l10n_ro_valued_type": "in_store"})
svls = self.env["stock.valuation.layer"].create(svl_values)
return svls

def _create_delivery_store_svl(self, forced_quantity=None):
svl_values = self._get_out_svl_vals(forced_quantity)
def _create_out_store_svl(self, forced_quantity=None):
svl_values = self._get_out_svl_vals(self.quantity)
for svl_value in svl_values:
svl_value.update(
{
"l10n_ro_valued_type": "delivery_store",
}
)
svl_value.update({"l10n_ro_valued_type": "out_store"})
svls = self.env["stock.valuation.layer"].create(svl_values)
return svls

Expand All @@ -62,18 +62,18 @@ def _account_entry_move(self, qty, description, svl_id, cost):
svl = self.env["stock.valuation.layer"].browse(svl_id)

am_val_store = False
if svl.l10n_ro_valued_type == "reception_store":
am_val_store = self._create_account_entry_reception_store(qty, description, svl_id, cost)
if svl.l10n_ro_valued_type == "in_store":
am_val_store = self._create_account_entry_in_store(qty, description, svl_id, cost)

if svl.l10n_ro_valued_type == "delivery_store":
am_val_store = self._create_account_entry_delivery_store(qty, description, svl_id, cost)
if svl.l10n_ro_valued_type == "out_store":
am_val_store = self._create_account_entry_out_store(qty, description, svl_id, cost)

if am_val_store:
am_vals = [am_val_store]

return am_vals

def _create_account_entry_reception_store(self, qty, description, svl_id, cost):
def _create_account_entry_in_store(self, qty, description, svl_id, cost):
company = self.company_id or self.env.company
uneligible_tax_account_id = company.l10n_ro_property_uneligible_tax_account_id.id
account_difference = self.product_id.categ_id.property_account_creditor_price_difference_categ.id
Expand Down Expand Up @@ -124,7 +124,7 @@ def _create_account_entry_reception_store(self, qty, description, svl_id, cost):
am_vals["line_ids"] += move_ids
return am_vals

def _create_account_entry_delivery_store(self, qty, description, svl_id, cost):
def _create_account_entry_out_store(self, qty, description, svl_id, cost):
company = self.company_id or self.env.company
uneligible_tax_account_id = company.l10n_ro_property_uneligible_tax_account_id.id
account_difference = self.product_id.categ_id.property_account_creditor_price_difference_categ.id
Expand Down
4 changes: 1 addition & 3 deletions l10n_ro_stock_account_store/models/stock_valuation_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
class StockValuationLayer(models.Model):
_inherit = "stock.valuation.layer"

l10n_ro_valued_type = fields.Selection(
selection_add=[("reception_store", "Reception in store"), ("delivery_store", "Delivery from store")]
)
l10n_ro_valued_type = fields.Selection(selection_add=[("in_store", "In store"), ("out_store", "Out store")])
l10n_ro_sale_amount = fields.Float(string="Sale Amount")

0 comments on commit 081c9d4

Please sign in to comment.