Port hr_holidays_lunch_voucher and hr_holidays_lunch_voucher_natixis to v10
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from . import company
|
from . import company
|
||||||
|
from . import purchase_config_settings
|
||||||
from . import hr_holidays
|
from . import hr_holidays
|
||||||
from . import hr_employee
|
from . import hr_employee
|
||||||
from . import lunch_voucher_attribution
|
from . import lunch_voucher_attribution
|
||||||
|
|||||||
@@ -12,17 +12,21 @@
|
|||||||
'description': '',
|
'description': '',
|
||||||
'author': 'Akretion',
|
'author': 'Akretion',
|
||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['hr_holidays_usability', 'purchase'],
|
'depends': [
|
||||||
|
'hr_holidays_usability',
|
||||||
|
'purchase',
|
||||||
|
'onchange_helper',
|
||||||
|
],
|
||||||
'data': [
|
'data': [
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'security/lunch_voucher_security.xml',
|
'security/lunch_voucher_security.xml',
|
||||||
'product_data.xml',
|
'product_data.xml',
|
||||||
'company_view.xml',
|
'purchase_config_settings_view.xml',
|
||||||
'wizard/lunch_voucher_purchase_view.xml',
|
'wizard/lunch_voucher_purchase_view.xml',
|
||||||
'lunch_voucher_attribution_view.xml',
|
'lunch_voucher_attribution_view.xml',
|
||||||
'hr_employee_view.xml',
|
'hr_employee_view.xml',
|
||||||
'hr_holidays_view.xml',
|
'hr_holidays_view.xml',
|
||||||
'wizard/hr_holidays_post_view.xml',
|
'wizard/hr_holidays_to_payslip_view.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,7 @@
|
|||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import models, fields
|
from odoo import models, fields
|
||||||
import openerp.addons.decimal_precision as dp
|
|
||||||
|
|
||||||
|
|
||||||
class ResCompany(models.Model):
|
class ResCompany(models.Model):
|
||||||
@@ -13,8 +12,8 @@ class ResCompany(models.Model):
|
|||||||
lunch_voucher_product_id = fields.Many2one(
|
lunch_voucher_product_id = fields.Many2one(
|
||||||
'product.product', string='Lunch Voucher Product',
|
'product.product', string='Lunch Voucher Product',
|
||||||
ondelete='restrict')
|
ondelete='restrict')
|
||||||
lunch_voucher_employer_price = fields.Float(
|
lunch_voucher_employer_price = fields.Monetary(
|
||||||
'Lunch Voucher Employer Price', digits=dp.get_precision('Account'))
|
'Lunch Voucher Employer Price', currency_field='currency_id')
|
||||||
|
|
||||||
# Add constrain to check that lunch_voucher_employer_price is between
|
# Add constrain to check that lunch_voucher_employer_price is between
|
||||||
# 50% and 60% of the price of lunch_voucher_product_id for France
|
# 50% and 60% of the price of lunch_voucher_product_id for France
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import models, fields
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
class HrEmployee(models.Model):
|
class HrEmployee(models.Model):
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
|
|
||||||
<record id="view_employee_form_leave_inherit" model="ir.ui.view">
|
<record id="view_employee_form_leave_inherit" model="ir.ui.view">
|
||||||
@@ -21,5 +20,4 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import models, fields, api
|
from odoo import models, fields, api
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +18,6 @@ class HrHolidays(models.Model):
|
|||||||
store=True, string='Lunch Vouchers to Deduct')
|
store=True, string='Lunch Vouchers to Deduct')
|
||||||
|
|
||||||
@api.depends('employee_id', 'vacation_date_from', 'vacation_date_to')
|
@api.depends('employee_id', 'vacation_date_from', 'vacation_date_to')
|
||||||
@api.multi
|
|
||||||
def _compute_lunch_voucher_remove_qty(self):
|
def _compute_lunch_voucher_remove_qty(self):
|
||||||
hhpo = self.env['hr.holidays.public']
|
hhpo = self.env['hr.holidays.public']
|
||||||
for hol in self:
|
for hol in self:
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
|
|
||||||
<record id="edit_holiday_new" model="ir.ui.view">
|
<record id="edit_holiday_new" model="ir.ui.view">
|
||||||
@@ -29,11 +28,10 @@
|
|||||||
<field name="inherit_id" ref="hr_holidays_usability.view_holiday"/>
|
<field name="inherit_id" ref="hr_holidays_usability.view_holiday"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="number_of_days" position="after">
|
<field name="number_of_days" position="after">
|
||||||
<field name="lunch_voucher_remove_qty" string="Lunch Vouchers -=" sum="Total"/>
|
<field name="lunch_voucher_remove_qty" string="Lunch Vouchers -=" sum="1"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import models, fields, api
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
class LunchVoucherAttribution(models.Model):
|
class LunchVoucherAttribution(models.Model):
|
||||||
@@ -35,7 +35,6 @@ class LunchVoucherAttribution(models.Model):
|
|||||||
'hr.holidays', 'lunch_voucher_id', readonly=True)
|
'hr.holidays', 'lunch_voucher_id', readonly=True)
|
||||||
|
|
||||||
@api.depends('month_work_days', 'holiday_ids.lunch_voucher_remove_qty')
|
@api.depends('month_work_days', 'holiday_ids.lunch_voucher_remove_qty')
|
||||||
@api.multi
|
|
||||||
def _compute_qty(self):
|
def _compute_qty(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
no_lunch_days = 0
|
no_lunch_days = 0
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
|
|
||||||
<record id="lunch_voucher_attribution_form" model="ir.ui.view">
|
<record id="lunch_voucher_attribution_form" model="ir.ui.view">
|
||||||
@@ -38,7 +37,7 @@
|
|||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<field name="employee_id"/>
|
<field name="employee_id"/>
|
||||||
<field name="month_work_days"/>
|
<field name="month_work_days"/>
|
||||||
<field name="no_lunch_days" sum="Total"/>
|
<field name="no_lunch_days" sum="1"/>
|
||||||
<field name="qty" sum="Total"/>
|
<field name="qty" sum="Total"/>
|
||||||
<field name="purchase_id"/>
|
<field name="purchase_id"/>
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
@@ -93,5 +92,4 @@
|
|||||||
view_mode="form"
|
view_mode="form"
|
||||||
target="new" />
|
target="new" />
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<openerp>
|
<odoo noupdate="1">
|
||||||
<data noupdate="1">
|
|
||||||
|
|
||||||
|
|
||||||
<record id="lunch_voucher_product" model="product.product">
|
<record id="lunch_voucher_product" model="product.product">
|
||||||
@@ -23,5 +22,4 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
|
|||||||
14
hr_holidays_lunch_voucher/purchase_config_settings.py
Normal file
14
hr_holidays_lunch_voucher/purchase_config_settings.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseConfigSettings(models.TransientModel):
|
||||||
|
_inherit = 'purchase.config.settings'
|
||||||
|
|
||||||
|
lunch_voucher_product_id = fields.Many2one(
|
||||||
|
related='company_id.lunch_voucher_product_id')
|
||||||
|
lunch_voucher_employer_price = fields.Monetary(
|
||||||
|
related='company_id.lunch_voucher_employer_price')
|
||||||
@@ -5,16 +5,15 @@
|
|||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
|
|
||||||
<record id="view_company_form" model="ir.ui.view">
|
<record id="view_purchase_configuration" model="ir.ui.view">
|
||||||
<field name="name">lunch_voucher.company.form</field>
|
<field name="name">lunch_voucher.purchase.config.settings.form</field>
|
||||||
<field name="model">res.company</field>
|
<field name="model">purchase.config.settings</field>
|
||||||
<field name="inherit_id" ref="base.view_company_form"/>
|
<field name="inherit_id" ref="purchase.view_purchase_configuration"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<group name="account_grp" position="after">
|
<xpath expr="//field[@name='module_stock_dropshipping']/.." position="after">
|
||||||
<group name="lunch_voucher" string="Lunch Vouchers">
|
<group name="lunch_voucher" string="Lunch Vouchers">
|
||||||
<field name="lunch_voucher_product_id"/>
|
<field name="lunch_voucher_product_id"/>
|
||||||
<!-- <field name="lunch_voucher_po_type"/> -->
|
<!-- <field name="lunch_voucher_po_type"/> -->
|
||||||
@@ -25,5 +24,4 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
access_lunch_voucher_attribution_full,Full access on lunch_voucher_attribution,model_lunch_voucher_attribution,base.group_hr_manager,1,1,1,1
|
access_lunch_voucher_attribution_full,Full access on lunch_voucher_attribution,model_lunch_voucher_attribution,hr.group_hr_manager,1,1,1,1
|
||||||
access_lunch_voucher_attribution_read,Read access on lunch_voucher_attribution,model_lunch_voucher_attribution,base.group_user,1,0,0,0
|
access_lunch_voucher_attribution_read,Read access on lunch_voucher_attribution,model_lunch_voucher_attribution,base.group_user,1,0,0,0
|
||||||
|
|||||||
|
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<odoo noupdate="1">
|
||||||
<data noupdate="1">
|
|
||||||
|
|
||||||
|
|
||||||
<record id="lunch_voucher_attribution_employee" model="ir.rule">
|
<record id="lunch_voucher_attribution_employee" model="ir.rule">
|
||||||
@@ -24,5 +23,4 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
from . import hr_holidays_post
|
from . import hr_holidays_to_payslip
|
||||||
from . import lunch_voucher_purchase
|
from . import lunch_voucher_purchase
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import models, fields, api
|
from odoo import models, fields, api
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class HrHolidaysPost(models.TransientModel):
|
class HrHolidaysToPayslip(models.TransientModel):
|
||||||
_inherit = 'hr.holidays.post'
|
_inherit = 'hr.holidays.to.payslip'
|
||||||
|
|
||||||
lunch_voucher_po = fields.Boolean(
|
lunch_voucher_po = fields.Boolean(
|
||||||
string='Generate Lunch Voucher Purchase Order')
|
string='Generate Lunch Voucher Purchase Order')
|
||||||
@@ -19,7 +19,7 @@ class HrHolidaysPost(models.TransientModel):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def default_get(self, fields_list):
|
def default_get(self, fields_list):
|
||||||
res = super(HrHolidaysPost, self).default_get(fields_list)
|
res = super(HrHolidaysToPayslip, self).default_get(fields_list)
|
||||||
hhpo = self.env['hr.holidays.public']
|
hhpo = self.env['hr.holidays.public']
|
||||||
company = self.env.user.company_id
|
company = self.env.user.company_id
|
||||||
if company.lunch_voucher_product_id:
|
if company.lunch_voucher_product_id:
|
||||||
@@ -47,7 +47,6 @@ class HrHolidaysPost(models.TransientModel):
|
|||||||
res['work_days'] = work_days
|
res['work_days'] = work_days
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
lvao = self.env['lunch.voucher.attribution']
|
lvao = self.env['lunch.voucher.attribution']
|
||||||
@@ -59,7 +58,7 @@ class HrHolidaysPost(models.TransientModel):
|
|||||||
lv_dict = {}
|
lv_dict = {}
|
||||||
for employee in employees:
|
for employee in employees:
|
||||||
lv_dict[employee.id] = []
|
lv_dict[employee.id] = []
|
||||||
for hol in self.holidays_to_post_ids:
|
for hol in self.holidays_to_payslip_ids:
|
||||||
if not hol.lunch_voucher_id and hol.employee_id.id in lv_dict:
|
if not hol.lunch_voucher_id and hol.employee_id.id in lv_dict:
|
||||||
lv_dict[hol.employee_id.id].append(hol.id)
|
lv_dict[hol.employee_id.id].append(hol.id)
|
||||||
for employee_id, hol_ids in lv_dict.iteritems():
|
for employee_id, hol_ids in lv_dict.iteritems():
|
||||||
@@ -71,4 +70,4 @@ class HrHolidaysPost(models.TransientModel):
|
|||||||
if hol_ids:
|
if hol_ids:
|
||||||
vals['holiday_ids'] = [(6, 0, hol_ids)]
|
vals['holiday_ids'] = [(6, 0, hol_ids)]
|
||||||
lvao.create(vals)
|
lvao.create(vals)
|
||||||
return super(HrHolidaysPost, self).run()
|
return super(HrHolidaysToPayslip, self).run()
|
||||||
@@ -5,16 +5,15 @@
|
|||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
|
|
||||||
<record id="hr_holidays_post_form" model="ir.ui.view">
|
<record id="hr_holidays_to_payslip_form" model="ir.ui.view">
|
||||||
<field name="name">hr_holidays_post_form</field>
|
<field name="name">hr.holidays.to.payslip.form</field>
|
||||||
<field name="model">hr.holidays.post</field>
|
<field name="model">hr.holidays.to.payslip</field>
|
||||||
<field name="inherit_id" ref="hr_holidays_usability.hr_holidays_post_form"/>
|
<field name="inherit_id" ref="hr_holidays_usability.hr_holidays_to_payslip_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="holidays_to_post_ids" position="before">
|
<field name="holidays_to_payslip_ids" position="before">
|
||||||
<field name="lunch_voucher_po" states="done"/>
|
<field name="lunch_voucher_po" states="done"/>
|
||||||
<field name="work_days"
|
<field name="work_days"
|
||||||
attrs="{'invisible': ['|', ('state', '!=', 'done'), ('lunch_voucher_po', '=', False)]}"/>
|
attrs="{'invisible': ['|', ('state', '!=', 'done'), ('lunch_voucher_po', '=', False)]}"/>
|
||||||
@@ -23,5 +22,4 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
@@ -3,15 +3,14 @@
|
|||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import models, api, _
|
from odoo import models, _
|
||||||
from openerp.exceptions import Warning as UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
class LunchVoucherPurchase(models.TransientModel):
|
class LunchVoucherPurchase(models.TransientModel):
|
||||||
_name = 'lunch.voucher.purchase'
|
_name = 'lunch.voucher.purchase'
|
||||||
_description = 'Purchase Lunch Vouchers Wizard'
|
_description = 'Purchase Lunch Vouchers Wizard'
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
company = self.env.user.company_id
|
company = self.env.user.company_id
|
||||||
@@ -45,24 +44,19 @@ class LunchVoucherPurchase(models.TransientModel):
|
|||||||
% lvoucher.employee_id.name)
|
% lvoucher.employee_id.name)
|
||||||
total_qty += lvoucher.qty
|
total_qty += lvoucher.qty
|
||||||
|
|
||||||
supplier = company.lunch_voucher_product_id.seller_id
|
supplier = company.lunch_voucher_product_id.seller_ids[0]
|
||||||
pick_type_id = poo.default_get(['picking_type_id'])['picking_type_id']
|
pick_type_id = poo.default_get(['picking_type_id'])['picking_type_id']
|
||||||
onchange_ptype_vals = poo.browse(False).onchange_picking_type_id(
|
vals = {'picking_type_id': pick_type_id, 'partner_id': supplier.id}
|
||||||
pick_type_id)
|
vals = poo.play_onchanges(vals, ['picking_type_id'])
|
||||||
vals = onchange_ptype_vals['value']
|
vals = poo.play_onchanges(vals, ['partner_id'])
|
||||||
onchange_vals = poo.browse(False).onchange_partner_id(supplier.id)
|
|
||||||
vals.update(onchange_vals['value'])
|
|
||||||
vals['partner_id'] = supplier.id
|
|
||||||
|
|
||||||
product = company.lunch_voucher_product_id
|
lvals = {
|
||||||
onchange_product_vals = polo.browse(False).onchange_product_id(
|
'product_id': company.lunch_voucher_product_id.id,
|
||||||
vals.get('pricelist_id'), product.id, total_qty, False,
|
'order_id': vals, 'product_qty': total_qty}
|
||||||
supplier.id, fiscal_position_id=vals.get('fiscal_position_id'))
|
lvals = polo.play_onchanges(lvals, ['product_id'])
|
||||||
lvals = onchange_product_vals['value']
|
# TODO check lvals['taxes_id'] uses (6, 0, ...)
|
||||||
lvals['product_id'] = product.id
|
print "lvals=", lvals
|
||||||
lvals['product_qty'] = total_qty
|
lvals.pop('order_id')
|
||||||
if lvals['taxes_id']:
|
|
||||||
lvals['taxes_id'] = [(6, 0, lvals['taxes_id'])]
|
|
||||||
vals['order_line'] = [(0, 0, lvals)]
|
vals['order_line'] = [(0, 0, lvals)]
|
||||||
po = poo.create(vals)
|
po = poo.create(vals)
|
||||||
lvouchers.write({'purchase_id': po.id})
|
lvouchers.write({'purchase_id': po.id})
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
<record id="lunch_voucher_purchase_form" model="ir.ui.view">
|
<record id="lunch_voucher_purchase_form" model="ir.ui.view">
|
||||||
<field name="name">lunch_voucher_purchase_form</field>
|
<field name="name">lunch_voucher_purchase_form</field>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button name="run" type="object" string="Create"
|
<button name="run" type="object" string="Create"
|
||||||
class="oe_highlight"/>
|
class="btn-primary"/>
|
||||||
<button special="cancel" string="Cancel" class="oe_link"/>
|
<button special="cancel" string="Cancel" class="oe_link"/>
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
@@ -32,5 +32,5 @@
|
|||||||
<field name="target">new</field>
|
<field name="target">new</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
|
||||||
</openerp>
|
</odoo>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from . import company
|
from . import company
|
||||||
|
from . import purchase_config_settings
|
||||||
from . import wizard
|
from . import wizard
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['hr_holidays_lunch_voucher'],
|
'depends': ['hr_holidays_lunch_voucher'],
|
||||||
'data': [
|
'data': [
|
||||||
'company_view.xml',
|
'purchase_config_settings_view.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import models, fields
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
class ResCompany(models.Model):
|
class ResCompany(models.Model):
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class PurchaseConfigSettings(models.TransientModel):
|
||||||
|
_inherit = 'purchase.config.settings'
|
||||||
|
|
||||||
|
lunch_voucher_natixis_customer_code = fields.Char(
|
||||||
|
related='company_id.lunch_voucher_natixis_customer_code')
|
||||||
|
lunch_voucher_natixis_delivery_code = fields.Char(
|
||||||
|
related='company_id.lunch_voucher_natixis_delivery_code')
|
||||||
@@ -5,14 +5,13 @@
|
|||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
|
|
||||||
<record id="view_company_form" model="ir.ui.view">
|
<record id="view_purchase_configuration" model="ir.ui.view">
|
||||||
<field name="name">natixis.lunch_voucher.company.form</field>
|
<field name="name">natixis.lunch_voucher.purchase.config.settings.form</field>
|
||||||
<field name="model">res.company</field>
|
<field name="model">purchase.config.settings</field>
|
||||||
<field name="inherit_id" ref="hr_holidays_lunch_voucher.view_company_form"/>
|
<field name="inherit_id" ref="hr_holidays_lunch_voucher.view_purchase_configuration"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<group name="lunch_voucher" position="inside">
|
<group name="lunch_voucher" position="inside">
|
||||||
<field name="lunch_voucher_natixis_customer_code"/>
|
<field name="lunch_voucher_natixis_customer_code"/>
|
||||||
@@ -22,5 +21,4 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
@@ -3,15 +3,14 @@
|
|||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from openerp import models, fields, api, _
|
from odoo import models, fields, _
|
||||||
from openerp.exceptions import Warning as UserError
|
from odoo.exceptions import UserError
|
||||||
from openerp.tools import float_is_zero
|
from odoo.tools import float_is_zero
|
||||||
|
|
||||||
|
|
||||||
class LunchVoucherPurchase(models.TransientModel):
|
class LunchVoucherPurchase(models.TransientModel):
|
||||||
_inherit = 'lunch.voucher.purchase'
|
_inherit = 'lunch.voucher.purchase'
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
action = super(LunchVoucherPurchase, self).run()
|
action = super(LunchVoucherPurchase, self).run()
|
||||||
|
|||||||
Reference in New Issue
Block a user