Skip to content

Commit

Permalink
test raport
Browse files Browse the repository at this point in the history
  • Loading branch information
dhongu committed Apr 16, 2024
1 parent cce4f03 commit 3918616
Show file tree
Hide file tree
Showing 16 changed files with 311 additions and 232 deletions.
8 changes: 4 additions & 4 deletions l10n_ro_stock_picking_report/README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
=========================
Romania - Picking Reports
=========================
====================================
Romania - Terrabit - Picking Reports
====================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:302b4fe5da876a317bb3166fef11bfdba75aebcd1b6d2d0d5e04d0d56cb71fc2
!! source digest: sha256:6543e4336a25e62c775041af6962003da5c5d26c13c7c1040d8ceea0c922311a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
9 changes: 5 additions & 4 deletions l10n_ro_stock_picking_report/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# See README.rst file on addons root folder for license details

{
"name": "Romania - Picking Reports",
"name": "Romania - Terrabit - Picking Reports",
"summary": "Rapoarte: NIR, aviz, bon consum",
"license": "AGPL-3",
"version": "15.0.1.1.2",
"version": "15.0.1.1.3",
"author": "Dorin Hongu," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-romania",
"category": "Generic Modules",
Expand All @@ -24,7 +25,7 @@
"views/stock_view.xml",
# "views/res_config_view.xml",
"views/stock_location_view.xml",
# "report/stock_picking_cumulative_view.xml",
# "security/ir.model.access.csv",
"report/stock_picking_cumulative_view.xml",
"security/ir.model.access.csv",
],
}
272 changes: 178 additions & 94 deletions l10n_ro_stock_picking_report/i18n/ro.po

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion l10n_ro_stock_picking_report/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details

from . import stock
from . import res_partner
from . import purchase
from . import account_invoice
from . import picking
Expand Down
36 changes: 35 additions & 1 deletion l10n_ro_stock_picking_report/models/picking.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# © 2008-2020 Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details

from odoo import models
from odoo import api, fields, models


class StockPicking(models.Model):
Expand All @@ -10,3 +10,37 @@ class StockPicking(models.Model):
def _get_report_base_filename(self):
self.ensure_one()
return "{} {}".format(self.picking_type_id.name, self.name)

origin = fields.Char(states={"done": [("readonly", False)]})
delegate_id = fields.Many2one("res.partner", string="Delegate")
mean_transp = fields.Char(string="Mean transport")

@api.onchange("delegate_id")
def on_change_delegate_id(self):
if self.delegate_id:
self.mean_transp = self.delegate_id.mean_transp

# metoda locala sau se poate in 10 are alt nume
@api.model
def _get_invoice_vals(self, key, inv_type, journal_id, move):
res = super()._get_invoice_vals(key, inv_type, journal_id, move)
if inv_type == "out_invoice":
res["delegate_id"] = move.picking_id.delegate_id.id
res["mean_transp"] = move.picking_id.mean_transp
return res

def do_print_picking(self):
self.write({"printed": True})
if self.picking_type_code == "incoming":
if self.location_dest_id.l10n_ro_merchandise_type == "store":
res = self.env.ref("l10n_ro_stock_picking_report.action_report_reception_sale_price").report_action(
self
)
else:
res = self.env.ref("l10n_ro_stock_picking_report.action_report_reception").report_action(self)

elif self.picking_type_code == "outgoing":
res = self.env.ref("l10n_ro_stock_picking_report.action_report_delivery").report_action(self)
else:
res = self.env.ref("l10n_ro_stock_picking_report.action_report_internal_transfer").report_action(self)
return res
12 changes: 12 additions & 0 deletions l10n_ro_stock_picking_report/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# © 2008-2020 Deltatech
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details


from odoo import fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

mean_transp = fields.Char(string="Mean transport")
95 changes: 0 additions & 95 deletions l10n_ro_stock_picking_report/models/stock.py

This file was deleted.

1 change: 1 addition & 0 deletions l10n_ro_stock_picking_report/models/stock_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ class StockLocation(models.Model):
_inherit = "stock.location"

store_pricelist_id = fields.Many2one("product.pricelist", string="Pricelist")
user_id = fields.Many2one("res.users", string="Manager")
2 changes: 1 addition & 1 deletion l10n_ro_stock_picking_report/report/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

from . import picking

# from . import stock_picking_cumulative
from . import stock_picking_cumulative
10 changes: 5 additions & 5 deletions l10n_ro_stock_picking_report/report/picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_line(self, move_line):
res["price"] = 0.0
list_price = 0.0

taxes_sale = taxes_ids.compute_all(list_price, quantity=move_line.product_qty, product=line.product_id)
taxes_sale = taxes_ids.compute_all(list_price, quantity=move_line.quantity_done, product=line.product_id)

res["tax"] = taxes_sale["total_included"] - taxes_sale["total_excluded"]
res["amount"] = taxes_sale["total_excluded"]
Expand Down Expand Up @@ -134,7 +134,7 @@ def _get_line(self, move):

taxes = line.taxes_id.compute_all(
res["price"],
quantity=move.product_qty,
quantity=move.quantity_done,
product=move.product_id,
partner=move.partner_id,
)
Expand All @@ -158,7 +158,7 @@ def _get_line(self, move):
taxes_sale = taxes_ids.compute_all(
list_price,
currency=currency,
quantity=move.product_uom_qty,
quantity=move.quantity_done,
product=move.product_id,
)

Expand All @@ -185,7 +185,7 @@ def _get_line(self, move):
taxes = taxes_ids.compute_all(
res["price"],
currency=currency,
quantity=move.product_uom_qty,
quantity=move.quantity_done,
product=move.product_id,
partner=move.partner_id,
)
Expand All @@ -208,7 +208,7 @@ def _get_line(self, move):
taxes_sale = taxes_ids.compute_all(
list_price,
currency=currency,
quantity=move.product_uom_qty,
quantity=move.quantity_done,
product=move.product_id,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class StockPickingCumulative(models.TransientModel):
picking_type_code = fields.Selection(related="picking_type_id.code")
origin = fields.Char()
group_id = fields.Char()
date_done = fields.Datetime()

report_id = fields.Many2one(
"ir.actions.report",
Expand All @@ -48,6 +49,7 @@ def default_get(self, fields_list):

res["date_from"] = fields.Date.to_string(from_date)
res["date_to"] = fields.Date.to_string(to_date)
res["date_done"] = res["date_to"]
return res

def button_show(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_stock_picking_cumulative_form" model="ir.ui.view">
<field name="name">stock.picking.cumulative.form</field>
<field name="model">stock.picking.cumulative</field>
<field name="arch" type="xml">
<form string="Report Options">
<group name="filters">
<group>
<field name="picking_type_id" />
<field name="report_id" />
</group>
<group name="date_range">
<field name="date_from" />
<field name="date_to" />
<field name="company_id" />
</group>
</group>
<footer>
<button name="button_show" string="Show" type="object" default_focus="1" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_stock_picking_cumulative" model="ir.actions.act_window">
<field name="name">Picking cumulative Report</field>
<field name="res_model">stock.picking.cumulative</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
id="menu_stock_picking_cumulative"
name="Picking cumulative Report"
action="action_stock_picking_cumulative"
parent="stock.menu_warehouse_report"
groups="stock.group_stock_user"
/>
</odoo>
2 changes: 2 additions & 0 deletions l10n_ro_stock_picking_report/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_picking_cumulative,access_stock_picking_cumulative,model_stock_picking_cumulative,stock.group_stock_user,1,1,1,1
8 changes: 4 additions & 4 deletions l10n_ro_stock_picking_report/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Romania - Picking Reports</title>
<title>Romania - Terrabit - Picking Reports</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,14 +360,14 @@
</style>
</head>
<body>
<div class="document" id="romania-picking-reports">
<h1 class="title">Romania - Picking Reports</h1>
<div class="document" id="romania-terrabit-picking-reports">
<h1 class="title">Romania - Terrabit - Picking Reports</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:302b4fe5da876a317bb3166fef11bfdba75aebcd1b6d2d0d5e04d0d56cb71fc2
!! source digest: sha256:6543e4336a25e62c775041af6962003da5c5d26c13c7c1040d8ceea0c922311a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/dhongu/l10n-romania/tree/15.0/l10n_ro_stock_picking_report"><img alt="dhongu/l10n-romania" src="https://img.shields.io/badge/github-dhongu%2Fl10n--romania-lightgray.png?logo=github" /></a></p>
<blockquote>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<field name="binding_model_id" ref="model_stock_picking" />
<field name="binding_type">report</field>
</record>
<!-- <record id="action_report_internal_transfer_cumulative" model="ir.actions.report">
<record id="action_report_internal_transfer_cumulative" model="ir.actions.report">
<field name="name">Internal transfer</field>
<field name="model">stock.picking.cumulative</field>
<field name="report_type">qweb-pdf</field>
Expand All @@ -90,6 +90,6 @@
<field name="print_report_name">(object._get_report_base_filename())</field>
<field name="binding_model_id" ref="model_stock_picking_cumulative" />
<field name="binding_type">report</field>
</record>-->
</record>
</data>
</odoo>
Loading

0 comments on commit 3918616

Please sign in to comment.