Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] l10n_ar_edi_ux: boarding permission
Task: 29241 X-original-commit: 391993c
- Loading branch information
1 parent
4a37101
commit 113efa3
Showing
7 changed files
with
118 additions
and
0 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
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
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,27 @@ | ||
from odoo import fields, models, api | ||
|
||
|
||
class L10nArBoardingPermission(models.Model): | ||
_name = "l10n_ar.boarding_permission" | ||
_description = 'Boarding Permission' | ||
|
||
number = fields.Char(string="Permiso de embarque", required=True, size=16) | ||
dst_country = fields.Many2one('res.country', string="País Origen", help="País donde se aplica permiso de embarque", required=True) | ||
company_id = fields.Many2one('res.company', required=True, default=lambda self: self.env.company) | ||
|
||
def name_get(self): | ||
result = [] | ||
for rec in self: | ||
result.append( | ||
(rec.id, "%s - %s" % (rec.number, rec.dst_country.display_name))) | ||
return result | ||
|
||
@api.model | ||
def name_search(self, name, args=None, operator='ilike', limit=100): | ||
args = args or [] | ||
recs = self.browse() | ||
if name: | ||
recs = self.search([('number', operator, name)] + args, limit=limit) | ||
if not recs: | ||
recs = self.search([('dst_country', operator, name)] + args, limit=limit) | ||
return recs.name_get() |
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
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,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="l10n_ar_boarding_permission_tree" model="ir.ui.view"> | ||
<field name="name">l10n_ar.boarding_permission.tree</field> | ||
<field name="model">l10n_ar.boarding_permission</field> | ||
<field name="arch" type="xml"> | ||
<tree> | ||
<field name="number"/> | ||
<field name="dst_country"/> | ||
<field name="company_id"/> | ||
</tree> | ||
</field> | ||
</record> | ||
|
||
<record id="l10n_ar_boarding_permission_form" model="ir.ui.view"> | ||
<field name="name">l10n_ar.boarding_permission.form</field> | ||
<field name="model">l10n_ar.boarding_permission</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<group> | ||
<field name="number"/> | ||
<field name="dst_country"/> | ||
<field name="company_id"/> | ||
</group> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record model="ir.actions.act_window" id="action_l10n_ar_boarding_permission"> | ||
<field name="name">Permisos de embarque</field> | ||
<field name="type">ir.actions.act_window</field> | ||
<field name="res_model">l10n_ar.boarding_permission</field> | ||
<field name="view_mode">tree,form</field> | ||
</record> | ||
|
||
<menuitem name="Permisos de embarque" action="action_l10n_ar_boarding_permission" id="menu_action_l10n_ar_boarding_permission" parent="l10n_ar.menu_afip_config"/> | ||
</odoo> |