-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] l10n_br_delivery_picking_label: print parcially
- Loading branch information
Tiago Amaral
committed
Sep 19, 2024
1 parent
4083062
commit 909f286
Showing
12 changed files
with
171 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import wizards | ||
from . import models |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_picking |
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,23 @@ | ||
# Copyright 2024 KMEE | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class StockPicking(models.Model): | ||
|
||
_inherit = "stock.picking" | ||
|
||
first_volume = fields.Integer() | ||
last_volume = fields.Integer() | ||
|
||
def action_partially_print(self): | ||
action = { | ||
"type": "ir.actions.act_window", | ||
"name": "Delivery Picking Label Wizard", | ||
"res_model": "delivery.picking.label.wizard", | ||
"view_mode": "form", | ||
"context": "{}", | ||
"target": "new", | ||
} | ||
return action |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_delivery_picking_label_wizard_user,access_delivery_picking_label_wizard_user,model_delivery_picking_label_wizard,stock.group_stock_user,1,1,1,1 |
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,22 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2024 KMEE | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
<record id="view_picking_form" model="ir.ui.view"> | ||
<field | ||
name="name" | ||
>stock.picking.form (in l10n_br_delivery_picking_label)</field> | ||
<field name="model">stock.picking</field> | ||
<field name="inherit_id" ref="stock.view_picking_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//button[@name='action_cancel']" position="after"> | ||
<button | ||
name="action_partially_print" | ||
string="Partially Print" | ||
type="object" | ||
attrs="{'invisible': [('number_of_volumes','in',[0, None, False])]}" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
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 @@ | ||
from . import delivery_picking_label_wizard |
47 changes: 47 additions & 0 deletions
47
l10n_br_delivery_picking_label/wizards/delivery_picking_label_wizard.py
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,47 @@ | ||
# Copyright 2024 KMEE | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class DeliveryPickingLabelWizard(models.TransientModel): | ||
|
||
_name = "delivery.picking.label.wizard" | ||
|
||
first_volume = fields.Integer(string="First Volume", default=1) | ||
last_volume = fields.Integer(string="Last Volume") | ||
picking_id = fields.Many2one( | ||
comodel_name="stock.picking", | ||
default=lambda self: self.env.context.get("active_id"), | ||
) | ||
|
||
def print(self): | ||
picking = self.env["stock.picking"].browse(self.env.context.get("active_id")) | ||
vals = { | ||
"first_volume": self.first_volume, | ||
"last_volume": self.last_volume, | ||
} | ||
picking.write(vals) | ||
return self.env.ref( | ||
"l10n_br_delivery_picking_label.report_delivery_picking_label" | ||
).report_action([]) | ||
|
||
@api.onchange("picking_id") | ||
def _onchange_picking_id(self): | ||
self.last_volume = self.picking_id.number_of_volumes | ||
|
||
@api.onchange("first_volume") | ||
def _onchange_first_volume(self): | ||
if self.first_volume < 1: | ||
self.first_volume = 1 | ||
|
||
if self.first_volume > self.last_volume: | ||
self.first_volume = self.last_volume | ||
|
||
@api.onchange("last_volume") | ||
def _onchange_last_volume(self): | ||
if self.last_volume > self.picking_id.number_of_volumes: | ||
self.last_volume = self.picking_id.number_of_volumes | ||
|
||
if self.last_volume < self.first_volume: | ||
self.last_volume = self.first_volume |
31 changes: 31 additions & 0 deletions
31
l10n_br_delivery_picking_label/wizards/delivery_picking_label_wizard.xml
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,31 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2024 KMEE | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
|
||
<record model="ir.ui.view" id="delivery_picking_label_wizard_form_view"> | ||
<field | ||
name="name" | ||
>delivery.picking.label.wizard.form (in l10n_br_delivery_picking_label)</field> | ||
<field name="model">delivery.picking.label.wizard</field> | ||
<field name="arch" type="xml"> | ||
<form string="Delivery Picking Label Wizard"> | ||
<group> | ||
<field name="first_volume" /> | ||
<field name="last_volume" /> | ||
<field name="picking_id" invisible="1" /> | ||
</group> | ||
<footer> | ||
<button | ||
name="print" | ||
string="OK" | ||
class="btn-primary" | ||
type="object" | ||
/> | ||
<button string="Cancel" class="btn-default" special="cancel" /> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
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,3 +1,10 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" /> | ||
<title>Declaração de Importação</title> | ||
<style type="text/css"> | ||
|
||
/* | ||
:Author: David Goodger ([email protected]) | ||
|
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 |
---|---|---|
|
@@ -8,10 +8,11 @@ | |
|
||
/* | ||
:Author: David Goodger ([email protected]) | ||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ | ||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ | ||
:Copyright: This stylesheet has been placed in the public domain. | ||
|
||
Default cascading style sheet for the HTML output of Docutils. | ||
Despite the name, some widely supported CSS2 features are used. | ||
|
||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to | ||
customize this style sheet. | ||
|
@@ -274,7 +275,7 @@ | |
margin-left: 2em ; | ||
margin-right: 2em } | ||
|
||
pre.code .ln { color: grey; } /* line numbers */ | ||
pre.code .ln { color: gray; } /* line numbers */ | ||
pre.code, code { background-color: #eeeeee } | ||
pre.code .comment, code .comment { color: #5C6576 } | ||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } | ||
|
@@ -300,7 +301,7 @@ | |
span.pre { | ||
white-space: pre } | ||
|
||
span.problematic { | ||
span.problematic, pre.problematic { | ||
color: red } | ||
|
||
span.section-subtitle { | ||
|